Roblox Scripting for Beginners: Your First Script
Roblox games are built in Roblox Studio and scripted in Luau, a version of the Lua language. Here is the shortest path to something that works.
Set up
Install Roblox Studio from the Roblox website, sign in, and open the Baseplate template. Find two panels: Explorer lists every object in your game, and Properties shows the settings of whatever you select.
Write your first script
Insert a Part into the Workspace. In Explorer, hover over the part, press the plus button, and add a Script. Replace its contents with this:
local part = script.Parent
part.Touched:Connect(function(hit)
part.BrickColor = BrickColor.Random()
end)
Press Play and walk into the part. It changes colour every time something touches it.
What the script does
- script.Parent is the object the script sits inside, here the part.
- Touched is an event. Events fire when something happens in the game.
- Connect attaches a function that runs each time the event fires.
Most Roblox scripting follows this pattern: find an object, wait for an event, change a property.

Ready to script a whole game?
The Ultimate Roblox Creator Guide takes you from your first script to coins, shops, saving progress and server-safe code, with working Luau in every chapter.
Ready for more than one script? The Ultimate Roblox Creator Guide by Grace covers scripting, game design and publishing step by step.
Server and client
A Script runs on Roblox's server and affects every player. A LocalScript runs on one player's device and handles things like their camera and menus. The two talk through RemoteEvents. Mixing them up causes most beginner bugs.
Next steps
- Make a part that removes a player's health on touch, then one that heals.
- Add a leaderboard that counts coins collected.
- Publish your game and ask friends to try it.
- Use the official Roblox Creator Hub documentation as your reference.

The Ultimate Roblox Creator Guide
The full playbook: build, code, publish and grow your own Roblox game. Ebook, $6.99.
