Type annotation

A label such as : number after a name, telling the type checker what a value should be.

Think of it as A label on a jar.

local amount: number = 5 says amount holds a number. The type checker in Studio and in luau-lsp reads annotations before the game runs and warns about mismatches. Annotations are ignored while the game runs, so values from outside the script, such as remote arguments, still need runtime checks.

Where the picture breaks

Labels are checked before the game runs, and only then. While it runs, nothing reads them, so a value that arrives from a client or a DataStore can be anything whatever its label says.

Annotations feed a static checker that runs on the source code. At run time Luau ignores them. Code that receives outside data marks it unknown and narrows it with typeof, comparisons or type guards before treating it as a specific type.

See it with the rest of the analogy cast

Official reference: create.roblox.com

Related terms