cache.replace — swap one instance for another in the executor cache
cache-replaceReplaces an executor's cached Instance reference so scripts resolving the original object receive a substitute instead, enabling controlled redirection for hitboxes, remotes, or checkpoints.
Instructions
Replace the executor's cached reference for one Instance with another via cache.replace(a, b). After the swap, every script that indexes instance A through the cache transparently receives instance B instead — a powerful redirection primitive for impersonating one object with another (e.g. pointing a checkpoint, hitbox, or remote wrapper at a substitute you control). Both targets are resolved from Luau path/expressions via loadstring('return ' .. expr). Requires the cache library (type(cache)=='table') with cache.replace — both are type-guarded and the call is pcall-wrapped, returning { error } when missing or on failure. Mutates live executor state. Returns { ok } or { error }. Signature: { instancePath: string, replacementPath: string, threadContext: number?, timeoutMs: number? }. Phase: act; cost=medium; idempotency=idempotent-write. Requires: active-client, resolved-target, explicit-mutation-approval. Produces: structured-result. 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 |
|---|---|---|---|
| timeoutMs | No | Optional per-call deadline in milliseconds; omit it to use the tool or server default. | |
| instancePath | Yes | Luau path/expression resolving to the Instance whose cached reference is replaced (A). Evaluated as `return <expression>`. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. | |
| replacementPath | Yes | Luau path/expression resolving to the Instance to substitute in (B). Evaluated as `return <expression>`. |