getoriginalenv
With no argument it returns the globals as they were when the executor loaded. Every function in it is a separate copy, so hookfunction on the global function leaves the copy unhooked, and the copies themselves cannot be hooked. The table and each library table in it are frozen; assigning to them raises an error.
Syntax
getoriginalenv(object: Instance | table?) -> table | Instance
Parameters
| Parameter | Type | Description |
|---|---|---|
object | Instance or table | Optional. An object or table whose metamethods you want to use without any hook on them. |
Returns
| Type | Description |
|---|---|
table | With no argument, a frozen environment of unhooked function copies. With an argument, a view that ignores hooks on its metamethods. |
Description
With an Instance it returns a view of that object. Reading a member or calling a method on the view skips any hookmetamethod hook on __index and __namecall and any hookfunction hook on the method. With a table it returns a view that reads through the table's own unhooked __index. Anything else raises an error.
getoriginalenv itself cannot be hooked or replaced in getgenv.
Example
local original = getoriginalenv()
print(original.print == print)
print(getoriginalenv(game):GetService("Workspace") == workspace)
These are Game executor contracts. Check build requirements and session lifetimes before using them.
