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.
- 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.
- 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.
