TutorialsMay 3, 202614 min read

Roblox Studio Scripting Tutorial: Learn Luau from Scratch

Complete Luau scripting tutorial for Roblox Studio. Learn variables, functions, events, and build 5 practical scripts step by step — no prior coding experience needed.

Learn Roblox Scripting (Luau) from Zero

Scripting is what brings Roblox games to life. Every mechanic — from a kill brick to a complex combat system — is powered by Luau scripts. This tutorial takes you from zero coding knowledge to writing practical game scripts.

Roblox Studio scripting tutorial — learn Luau coding

Basics: Variables and Print

local playerName = "Alex"
local score = 100
local isAlive = true

print("Player:", playerName)
print("Score:", score)

Functions

local function greetPlayer(name)
  print("Welcome, " .. name .. "!")
end

greetPlayer("Alex")  -- prints: Welcome, Alex!

Events — The Heart of Roblox Scripting

Roblox is event-driven. Things happen when players touch parts, click buttons, or join the game.

-- When a player touches a part
script.Parent.Touched:Connect(function(hit)
  print(hit.Name .. " touched me!")
end)

5 Practical Scripts

Script 1: Kill Brick

script.Parent.Touched:Connect(function(hit)
  local humanoid = hit.Parent:FindFirstChild("Humanoid")
  if humanoid then
    humanoid.Health = 0
  end
end)

Script 2: Speed Boost Pad

script.Parent.Touched:Connect(function(hit)
  local humanoid = hit.Parent:FindFirstChild("Humanoid")
  if humanoid then
    humanoid.WalkSpeed = 50
    task.wait(5)
    humanoid.WalkSpeed = 16
  end
end)
Luau code examples in Roblox Studio — kill brick, speed boost

Script 3: Disappearing Platform

local part = script.Parent

part.Touched:Connect(function(hit)
  if hit.Parent:FindFirstChild("Humanoid") then
    task.wait(1)
    part.Transparency = 1
    part.CanCollide = false
    task.wait(3)
    part.Transparency = 0
    part.CanCollide = true
  end
end)

Script 4: Coin Collector

local coin = script.Parent

coin.Touched:Connect(function(hit)
  local player = game.Players:GetPlayerFromCharacter(hit.Parent)
  if player then
    local stats = player:FindFirstChild("leaderstats")
    if stats then
      stats.Coins.Value += 1
      coin:Destroy()
    end
  end
end)

Script 5: Door with Key

local door = script.Parent
local requiredCoins = 10

door.Touched:Connect(function(hit)
  local player = game.Players:GetPlayerFromCharacter(hit.Parent)
  if player then
    local coins = player.leaderstats.Coins
    if coins.Value >= requiredCoins then
      door.Transparency = 0.5
      door.CanCollide = false
      task.wait(3)
      door.Transparency = 0
      door.CanCollide = true
    end
  end
end)

Skip the Coding — Use AI

If scripting isn't your thing, Obby writes all the Luau code for you. Describe what you want and the AI generates working scripts instantly.

Try Obby free →

Frequently Asked Questions

What language does Roblox use for scripting?

Roblox uses Luau, a typed language derived from Lua. It's specifically designed for Roblox and is beginner-friendly.

How long does it take to learn Roblox scripting?

Basic scripting (kill bricks, speed pads, coins) can be learned in a weekend. Intermediate skills (combat systems, data saving) take 2-4 weeks of practice.

Ready to build your Roblox game?

Obby lets you build Roblox games with AI — describe your game and we build it. No coding required.

Try Obby Free →