Returns the global environment table of a running script. Reading it exposes the script’s globals and its locals-turned-globals, which is how you reach a game script’s own functions and state. The script must be running; a module that was never required has no environment to read.

Parameters

Instance
required
A running LocalScript, ModuleScript, or Script.

Returns

table
The script’s global environment.

Example

Errors