null
Absence of a value. nullptr is accepted as a synonym. Emits Luau nil.
Syntax
Section titled “Syntax”Player ref = null;if (player != null) { }Parameters
Section titled “Parameters”None.
Return value
Section titled “Return value”The nil value.
Luau emit
Section titled “Luau emit”nil
Description
Section titled “Description”There is no C NULL macro. Compare with !=. guard (player != null) is the usual early-out.
Uninitialized locals (int coins;) also emit nil — always initialize.
Example
Section titled “Example”Player playerRef = null;guard (playerRef != null) else { return;}Emits:
local playerRef: Player = nilif not (playerRef ~= nil) then returnend