Skip to content
Scripts & runtimeOverview

getsenv

Represents inspection of a script environment.

Details#

Returns the live global environment of an available LocalScript or Script thread, or nil. It excludes frame locals and upvalues, does not start the script and does not accept ModuleScript as a substitute for getmenv.

Examples#

Example

Luau
local ownScript = Instance.new("LocalScript")
print(getsenv(ownScript)) -- nil without a running thread
ownScript:Destroy()