Set an upvalue of a live function (MUTATES STATE)
set-closure-upvaluePatch a live function in place by overwriting its 1-based captured upvalue via a resolved Luau expression; requires confirm=true and persists for future calls.
Instructions
WRITES LIVE GAME STATE. DANGER — Resolve a Luau expression to a function and overwrite one of its upvalues (a variable captured by the closure) via setupvalue. Use this to patch a function's behavior in place without rehooking it — e.g. flip a captured enabled boolean, swap a captured config table, or zero out a captured cooldown. The change persists for every future call of that exact closure and is shared by all closures that captured the same upvalue, so it can destabilize the game or trip anticheat. Index is 1-based and must be within the function's upvalue count (inspect-closure reports UpvalueCount). Requires setupvalue. Pass confirm=true to proceed. Returns { Target, Index, ok } or { error }. Signature: { functionPath: string, index: number, value: { kind: "string" | "number" | "boolean" | "nil" | "raw", value: string | number | boolean? }, confirm: boolean, threadContext: number? }. Phase: act; cost=medium; idempotency=idempotent-write. Requires: active-client, resolved-target, explicit-mutation-approval. Capabilities: debug closure primitives. 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 |
|---|---|---|---|
| index | Yes | 1-based index of the upvalue to overwrite. Must be within the function's upvalue count (see UpvalueCount from inspect-closure). | |
| value | Yes | New value for the upvalue. kind 'string'|'number'|'boolean' uses value literally; kind 'nil' sets nil; kind 'raw' treats value as a Luau expression evaluated for its result (e.g. value='Vector3.new(0,0,0)' or 'game.Workspace'). | |
| confirm | Yes | Must be true to actually mutate the live function. When omitted or false, the tool refuses and changes nothing. | |
| functionPath | Yes | Luau expression resolving to the function whose upvalue you want to change, e.g. 'getsenv(game.Players.LocalPlayer.PlayerScripts.Main).update' or 'getrawmetatable(game).__namecall'. Evaluated as `return <functionPath>`. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |