Dump a function's environment (getfenv)
get-function-envResolve a Luau expression to a function and dump its environment table to inspect reachable globals, detect sandbox/proxy environments, and discover sibling functions for inspection or hooking.
Instructions
Resolve a Luau expression to a function and dump its function environment table via getfenv. This is the _ENV the function reads its globals from: the global table the closure sees (often the script's environment, or a sandboxed proxy). Use it to learn what globals a handler can reach, to spot a sandbox/proxy environment, or to discover sibling functions you can then inspect or hook by reference. Read-only. Requires getfenv. Returns { Target, KeyCount, Truncated, Keys } (keysOnly) or { Target, KeyCount, Truncated, Entries } or { error }. Signature: { functionPath: string, keysOnly: any?, maxKeys: any?, threadContext: number? }. Phase: observe; cost=medium; idempotency=read-only. Requires: active-client, resolved-target. Produces: structured-observation. Safety: read-only. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxKeys | No | Maximum number of environment keys/entries to return before truncating (default 200). | |
| keysOnly | No | When true (default) return only the environment key names — cheap and safe. When false also serialize each value's type and a scalar/string preview via __encVal. | |
| functionPath | Yes | Luau expression resolving to a function, e.g. 'getsenv(game.Players.LocalPlayer.PlayerScripts.Main).update', 'getrawmetatable(game).__namecall', or a function found via the gc-scan tools. Evaluated as `return <functionPath>`. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |