Kids can start a Roblox game in Roblox Studio by making a small place, adding a server Script, and learning one behavior at a time. The examples below move from a visible message to conditions, functions, touch events, and a disappearing platform. Roblox scripting uses Luau, a language derived from Lua 5.1; “Lua scripts” is a common search phrase, but Luau is the language used in Studio.
What you need before writing a Roblox script
Roblox describes Studio as a free application for Windows or Mac. Create a Roblox account, install Studio, and open a new place. In Studio, the Explorer shows the place’s object hierarchy: parts make up physical objects, while scripts add behavior. The kind and location of a script affect where it runs.
As an Amazon Associate I earn from qualifying purchases.
These examples use regular Script objects placed in ServerScriptService, which Roblox uses in its first-script tutorial. A Script runs on the server; a LocalScript runs on the client, and a ModuleScript can be required by server or client scripts. Put the code in the stated location rather than placing every script wherever convenient.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →To add a script, find ServerScriptService in Explorer, insert a Script, and edit it in the Script Editor. Open the Output window, then use Studio’s Play control to run the place. The editor also provides autocomplete, syntax highlighting, static linting, type checking, and script analysis; use its diagnostics to spot code issues and Output to see runtime messages.
#1 Best Overall
- Redemption: Online only. Robux cards can only be redeemed in a browser at Roblox.com/redeem. They cannot be redeemed in the Roblox mobile app or any video game console.
- Roblox is an immersive platform for connection and communication. Every day, millions of people come to Roblox to create, play, work, learn, and connect with each other in experiences built by our global community of creators.
- Get more with every Roblox Gift Card! From now on, when you redeem a Roblox gift card, you get up to 25% more Robux. Perfect for gaming, creating, and exploring- more Robux means more possibilities!
- Deck out your avatar and unlock additional perks in your favorite experiences when you use Roblox Gift Cards to purchase Robux (Roblox's virtual currency).
- Each gift card grants a free virtual item upon redemption.
Roblox’s official learning path covers variables and objects, functions and events, conditionals, loops, tables, and organized code. These six examples are a starter sequence, not a replacement for the full curriculum. Change one value at a time and playtest after each change.
1. Print a message when the game starts
Where it goes
In Explorer, select ServerScriptService and insert a Script. Name it HelloGame.
Code
print("Hello, game!")
What to notice and change
Press Play and look in Output for Hello, game!. This confirms the script ran. Change the text inside the quotation marks and play again. print() sends a message to Output; it does not display text to players in the game world.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- The easiest way to add Robux (Roblox’s digital currency) to your account. Use Robux to deck out your avatar and unlock additional perks in your favorite Roblox experiences.
- This is a digital gift card that can only be redeemed for Robux at Roblox.com/redeem. It cannot be redeemed in the Roblox mobile app or any video game console. Please allow up to 5 minutes for your balance to be updated after redeeming.
- Roblox Gift Cards can be redeemed worldwide, perfect for gifting to Roblox fans anywhere in the world.
- From now on, when you redeem a Roblox Gift Card, you get up to 25% more Robux. Perfect for gaming, creating, and exploring- more Robux means more possibilities!
- Every Roblox Gift Card grants a free virtual item upon redemption.
2. Store a message in a variable
Where it goes
Keep this as a separate Script in ServerScriptService; name it WelcomeMessage.
Code
local message = "Welcome to my game!"
print(message)
What to notice and change
When you play, Output shows the value stored in message. The word local makes this variable available in its local scope, rather than making it a global variable. Change the text, or try a number instead: set message to 3 and see what Output prints.
3. Make a decision with an if statement
Where it goes
Add another Script to ServerScriptService and name it ChooseMessage.
Rank #3
- The easiest way to add Robux (Roblox’s digital currency) to your account. Use Robux to deck out your avatar and unlock additional perks in your favorite Roblox experiences.
- This is a digital gift card that can only be redeemed for Robux at Roblox.com/redeem. It cannot be redeemed in the Roblox mobile app or any video game console. Please allow up to 5 minutes for your balance to be updated after redeeming.
- Roblox Gift Cards can be redeemed worldwide, perfect for gifting to Roblox fans anywhere in the world.
- From now on, when you redeem a Roblox Gift Card, you get up to 25% more Robux. Perfect for gaming, creating, and exploring- more Robux means more possibilities!
- Every Roblox Gift Card grants a free virtual item upon redemption.
Code
local coins = 5
if coins >= 5 then
print("You have enough coins!")
else
print("Collect more coins.")
end
What to notice and change
With coins set to 5, Output shows the first message. An if statement checks a condition; else supplies the alternative when that condition is false. Change coins to 2 and play again to see the other result. This example only prints a message; it does not create or save in-game coins.
Recommended Free Tools
4. Reuse an action with a function
Where it goes
Create a separate Script in ServerScriptService named SayWelcome.
Code
local function sayWelcome()
print("Welcome to the adventure!")
end
sayWelcome()
What to notice and change
The function holds an action, and sayWelcome() calls it. Run the place and check Output. Then call the function a second time on a new line to make the message appear twice. Functions become especially useful when connected to events, so the action runs in response to something that happens.
Rank #4
- The easiest way to add Robux (Roblox’s digital currency) to your account. Use Robux to deck out your avatar and unlock additional perks in your favorite Roblox experiences.
- This is a digital gift card that can only be redeemed for Robux at Roblox.com/redeem. It cannot be redeemed in the Roblox mobile app or any video game console. Please allow up to 5 minutes for your balance to be updated after redeeming.
- Roblox Gift Cards can be redeemed worldwide, perfect for gifting to Roblox fans anywhere in the world.
- From now on, when you redeem a Roblox Gift Card, you get up to 25% more Robux. Perfect for gaming, creating, and exploring- more Robux means more possibilities!
- Every Roblox Gift Card grants a free virtual item upon redemption.
5. React when something touches a part
Where it goes
In Explorer, add a Part to Workspace. Keep it anchored so it stays in place, and give it a name such as WelcomePad. Insert a Script inside that part.
Code
local part = script.Parent
local function onTouched(otherPart)
print("Something touched the pad!")
end
part.Touched:Connect(onTouched)
What to notice and change
Press Play and move your character into the part. The Touched event fires when something touches the part, and Connect() attaches the function that responds. Check Output for the message. Change the message, or change the part’s Color in Properties and then set its color from inside onTouched to make the reaction visible. A touch can produce multiple event calls as different character parts make contact.
6. Make a platform disappear when touched
Where it goes
Add a second anchored Part to Workspace, name it VanishingPlatform, and place it where the character can reach it. Insert a Script inside the part.
Best Value
- The easiest way to add Robux (Roblox’s digital currency) to your account. Use Robux to deck out your avatar and unlock additional perks in your favorite Roblox experiences.
- This is a digital gift card that can only be redeemed for Robux at Roblox.com/redeem. It cannot be redeemed in the Roblox mobile app or any video game console. Please allow up to 5 minutes for your balance to be updated after redeeming.
- Roblox Gift Cards can be redeemed worldwide, perfect for gifting to Roblox fans anywhere in the world.
- From now on, when you redeem a Roblox Gift Card, you get up to 25% more Robux. Perfect for gaming, creating, and exploring- more Robux means more possibilities!
- Every Roblox Gift Card grants a free virtual item upon redemption.
Code
local platform = script.Parent
local disappearing = false
local function onTouched(otherPart)
if disappearing then
return
end
disappearing = true
platform.Transparency = 1
platform.CanCollide = false
end
platform.Touched:Connect(onTouched)
What to notice and change
Touching the platform makes it transparent and turns off collision, so the character can pass through it. The disappearing variable prevents the function from running its change repeatedly after the first touch. Try changing Transparency to 0.5 for a partly visible platform. This version does not make the platform return; a timed reset would need additional logic.
Why these scripts run in different ways
The first four scripts run when the server starts the script during a playtest. The last two connect a function to a part’s touch event, so the function runs when that event occurs. Events are a common way to respond to gameplay without repeatedly checking for the same condition in a loop.
The visible results also differ: print() writes to Output for the creator, while changing a part’s properties affects the game world. Parts expose properties such as Transparency and CanCollide, which scripts can change to create simple gameplay effects.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesHow to troubleshoot a beginner script
- Nothing appears in Output: Confirm the script is a
ScriptinServerScriptServiceand that you pressed Play. Open Output and check for runtime messages. - The editor marks a line: Check spelling, quotation marks, parentheses, and the
endstatements for functions and conditionals. Read the Script Editor’s diagnostics. - The touch script does not react: Make sure the script is inside the part you intend to use, and that the character can reach the part during Play mode.
- The platform still blocks the character: Verify the code sets
CanCollidetofalseand that you are touching the same part that contains the script.
Roblox’s Luau documentation explains the language used in Studio. Its scripting introduction covers local variables and Roblox scripting, while the create-a-script tutorial walks through script placement and Output. For the concepts behind the examples, see Coding fundamentals, Events, the Data model, and the Introduction to scripting. To continue from a first place into broader projects, use Roblox’s Core curriculum.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




