Home/Guides/First Roblox Studio script: Luau, print and Output window
Devices and settings

First Roblox Studio script: Luau, print and Output window

Start with a small script in your own Studio project. The message in Output helps verify that the code actually runs.

Roblox
Roblox · Roblox Corporation

Create a Script in ServerScriptService

In Explorer, find ServerScriptService, click plus and select Script. Rename it, for example, PracticeScript, so that you can find it among the objects later. This tutorial is about coding your own project in Roblox Studio. First, leave one simple example: this makes it easier to associate the output with a specific script and see the result of the change.

Display the first message

Enter an example below. print prints a string that is inside regular quotes. Open Output via the Window menu and start playtest. GameWorld test should appear in the output. Then click Stop and return to the editor. The text in the editor window itself does not mean that the script has been executed.

print("GameWorld test")

Add a local variable

Replace the first example with this code. local specifies a local variable; The = operator assigns a value and print shows it. The name message is part of the code, the line GameWorld test is the text to be displayed. For the first experiment, change only the string inside the quotes. Run playtest again and check if Output matches the new value.

local message = "GameWorld test"
print(message)

How to look for a simple error

If red text appears, read the message and the location indicated. Check the closing parenthesis, both quotes and the same spelling of the variable name. For comparison, go back to the short working example and add changes one at a time. Save the original version next to the result of the check. Once the output is clear, you can move on to events and objects in the official Luau tutorials, keeping the same way of checking through Output.

Sources and checks

Guides are automatically translated from Russian; interface labels may differ. The Russian edition is the original.

Keep reading

↑