Replace a closure's environment table
set-function-envWrites live game state by changing a Roblox function's global environment via setfenv, resolving the target function and environment expression; confirm=true required.
Instructions
WRITES LIVE GAME STATE. Resolve a function and an environment-table expression, then call setfenv. This changes global lookup behavior for the live closure and requires confirm=true. Signature: { functionPath: string, threadContext: number?, environmentExpression: string, confirm: boolean? }. Phase: act; cost=medium; idempotency=idempotent-write. Requires: active-client, resolved-target, explicit-mutation-approval. Produces: operation-receipt. Verify with: assert-state. Safety: MUTATING; writes live game/client state. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| confirm | No | Explicit safety acknowledgement; must be true before this state-changing operation runs. | |
| functionPath | Yes | Luau expression resolving to the target function. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. | |
| environmentExpression | Yes | text value for environment expression. |