A comment is text that the Luau parser ignores at runtime.

Single-line Comments

You can define single-line comments with a double hyphen (--) anywhere outside a string. Single-line comments extend to the end of the line.

Use single line comments for in-line notes. If the comment spans multiple lines, use multiple single-line comments.

You can add and remove single-line comments in the Script Editor with the keyboard shortcut Ctrl/Cmd + /.

-- This condition is really important because the world would blow up if it
-- were missing.
if not foo then

Block Comments

You can define multiline block comments with double hyphens and double brackets (--[[]]). Use block comments for documenting items:

  • Use a block comment at the top of files to describe their purpose.
  • Use a block comment before functions or objects to describe their intent.

Shuts off the cosmic moon ray immediately.
Should only be called within 15 minutes of midnight Mountain Standard
Time, or the cosmic moon ray may be damaged.
local function stopCosmicMoonRay()