Appearance
Your First Script
Written: 2026-10-14
Learning objectives
- Run
printin the Command Bar and read the result. - Create a Script in ServerScriptService with
--!strict. - Press Play and find your message in Output.
- Explain in your own words what Play does.
Prerequisites
- Read Introduction for programs and errors.
- Read Studio and Environment for Explorer, Properties, and Output.
- Open a new baseplate place so you can practice safely.
Print in the Command Bar
The Command Bar runs one line now. It does not save the line.
Open the Command Bar from the Script tab toolbar or the Window menu. The Studio interface says the Command Bar lets you execute Luau code outside of scripts. Type this in the Command Bar, then press Run:
luau
print("Hello, Roblox!")print means show these words for testing. print receives values and prints them to the output. The words inside quotes are a string. A string means text between quotes.
Look at the Output window. That window displays messages from calls to print. You should see:
txt
Hello, Roblox!If you see nothing, check Output is open. Run again. In solo Play use the Show Context filter to tell client entries from server entries (see Output); red entries are errors.
Your first Script in ServerScriptService
A Script saves code. Roblox runs it when the game starts.
Find ServerScriptService in Explorer. ServerScriptService is a container service for server-only Script objects. The server runs code placed there.
Do these steps:
- Click ServerScriptService in Explorer.
- Press the plus button. Insert a Script. A Script means saved Luau code that runs on the server.
- Double-click the new Script. The Script Editor opens. That editor is the text area where you type Luau code.
- Delete the starting text. Put this Script in ServerScriptService and press Play:
luau
--!strict
print("Hello from the server!")The first line --!strict turns on full checks for this file. Type checking with --!strict asserts all types based on inferred or annotated types. For now this means Studio warns you sooner. You do not need to learn types yet.
The second line prints your message. Keep the quotes and the parentheses exact.
Press Play and read Output
Press Play in Studio. It starts a test game on your computer. The server starts and your Script runs once.
Watch the Output window. You should see:
txt
Hello from the server!Press Stop when you finish. It ends the test. Change the text, then press Play again to test the change.
Read Output each time. Use the Show Context filter to tell client messages from server messages. Red lines name the script and line number. Open that line if you see red. You will learn full debugging moves in debugging basics.
Common mistakes
Wrong:
Print("Hello!")with a capital P. Why: Luau words are case-sensitive, and the true name is lowercase print. Fix: Put this fixed Script in ServerScriptService and press Play.Wrong code:
luauPrint("Hello!")Fixed code, put this Script in ServerScriptService and press Play:
luau--!strict print("Hello!")Wrong:
print(Hello!)with no quotes. Why: Without quotes Roblox thinksHellois a name, not text. Fix: Type the fixed line in the Command Bar, or put it in ServerScriptService and press Play.Wrong code:
luau--!strict print(Hello!)Fixed code, type this in the Command Bar or put it in a Script and press Play:
luau--!strict print("Hello!")Wrong: You put the Script in Workspace and it still runs, so you think location never matters. Why: Some places run code, but ServerScriptService is the safe server home you can trust. Fix: Move practice Scripts into ServerScriptService and press Play again.
Exercises
- Type a new message in the Command Bar and run it.
- Change your Script in ServerScriptService to print your name, then press Play and read Output.
Solution 1
Type this in the Command Bar, then press Run:
luau
print("I am learning Luau!")You should see in Output:
txt
I am learning Luau!Solution 2
Put this Script in ServerScriptService and press Play:
luau
--!strict
print("Maya is here!")Use your own name inside the quotes. You should see your line in Output:
txt
Maya is here!Press Stop when you finish.
Summary
You ran print in the Command Bar for quick tests. You saved a Script with --!strict in ServerScriptService. You pressed Play and read Output. Small tests build real skill.
Next, start Level 1 with Variables and Values.