getsenv
Returns the environment of the given script thread.
function getsenv(script: Script | LocalScript | ModuleScript): { [any]: any }
Parameter
script
- The module/script the function gets the globals table of.
Example
local ScriptEnv = getsenv(game.Players.LocalPlayer.Character.Animate)
print(ScriptEnv.onSwimming) -- Output: function 0x...
print(getsenv(Instance.new("LocalScript"))) -- Throws an error
Last updated