Roblox games are programmed in Luau, a language based on Lua. You don’t need to know any code yet. By the end of this guide you’ll have a script that changes your world when a character touches something.
What you need
- Roblox Studio, available on Windows and Mac.
- A Roblox account to sign in to Studio.
- About 20 minutes and a new place to experiment.
Open Studio and make a Baseplate
- Open Roblox Studio and sign in.
- Create a new place using the Baseplate template.
- Open the Explorer and Output windows. Explorer shows your objects; Output shows messages and errors.
Your first Script
In Explorer, add a Script inside ServerScriptService. Replace its contents with this:
-- Your first scriptprint("Hello from my game!")local part = workspace.Baseplatepart.BrickColor = BrickColor.new("Bright green")Press Play. The message appears in Output and the Baseplate turns green. Stop the test before editing again: changes made during a playtest may not persist.
Script vs LocalScript
| Type | Runs on | Use it for |
|---|---|---|
| Script | The server, with default settings | Shared game rules: doors, kill bricks, leaderboards |
| LocalScript | One player’s device | Menus, buttons, camera effects |
| ModuleScript | Wherever it is required | Reusable functions and configuration |
Make something happen
Add an anchored Part to Workspace, name it KillBrick, and put a new Script inside that Part. This example resets any character with a Humanoid that touches it, including NPCs:
-- Put this Script inside an anchored Partlocal brick = script.Parentbrick.Touched:Connect(function(hit) local character = hit.Parent local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid then humanoid.Health = 0 endend)brick.Touched:Connect(function(hit)
FindFirstChildOfClass("Humanoid")humanoid.Health = 0
Keep CanTouch enabled on the brick, then walk into it in Play mode. These are learning examples; test them in your own place before publishing.
Next steps
Build your next small idea.
Try the generator