Skip to content
1 / 5
Lesson 01 of 05

Printing and Comments

Your first lines of code — output text, use comments, and understand the developer console.

Printing to the console is the first skill every Luau programmer learns. The print() function outputs text, numbers, booleans, or variables to the output window.

The print() function accepts multiple arguments separated by commas, automatically inserting tabs between values. You can print strings directly, concatenate using the .. operator, or embed variables.

For debugging
  • print() outputs normal white text
  • warn() prints yellow warning messages
  • error() prints red errors and halts execution

In Roblox Studio, use F9 to open the Developer Console.

Comments help document your code
  • Single-line: -- this is a comment
  • Multi-line: --[[ like this ]]

Comments serve multiple purposes beyond simple notes. Use -- TODO: to mark incomplete features, -- FIXME: for bugs, or -- HACK: for temporary solutions. Multi-line comments with --[[ ]]-- can temporarily disable large code blocks during testing.

luau
1-- Single line comment
2print("Hello, Roblox World!") -- prints to output
3
4warn("This is a warning") -- yellow text
5-- error("This stops the script") -- red text, halts
6
7-- Concatenation with ..
8local name = "Alex"
9print("Hello, " .. name .. "!")
10
11-- Multiple arguments (tab-separated)
12print("Health:", 100, "Mana:", 50)
13
14--[[
15 Multi-line comment block.
16 Great for temporarily disabling code.
17 Or writing detailed explanations.
18]]
READY · 18 lines