Scripts
getsenv
Returns the environment table associated with a LocalScript, Script, or ModuleScript. Unsupported script objects or scripts without an available thread raise the same errors as the underlying script lookup.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Returns the environment table associated with a LocalScript, Script, or ModuleScript. Unsupported script objects or scripts without an available thread raise the same errors as the underlying script lookup.
getsenv(script: userdata): table
local targetScript
for _, descendant in ipairs(game:GetDescendants()) do
if descendant:IsA("LuaSourceContainer") then
targetScript = descendant
break
end
end
if targetScript then
local environment = getsenv(targetScript)
print(environment)
end