Skip to content
Saiko

getrenv

Returns the game's global environment, separate from the executor's. Reading it shows the globals game scripts actually see.

Signature

luau
getrenv(): { [any]: any }

Returns

table

Example

luau
-- the game's environment, not yours
local env = getrenv()
print(env.print == print) --> usually false: the game has its own copy
env.shared.fromExecutor = true
print(shared.fromExecutor) --> nil, `shared` here is yours