Set (or clear) a custom attribute on a live Instance
set-attributeWrite a custom attribute on a live Roblox instance by resolving a Luau expression and calling inst:SetAttribute, returning old and new values for auditing.
Instructions
WRITES LIVE GAME STATE. Resolve a Luau expression to an Instance and write one of its custom attributes via inst:SetAttribute(name, value), returning both the OLD and NEW value so the change is auditable. Attributes are the named, typed key/value pairs games store on instances (visible in the Studio Attributes panel and read with :GetAttribute) — distinct from engine properties (use set-instance-property for those). Common uses while debugging: flip a 'IsAdmin'/'Frozen' boolean attribute, bump a 'Cooldown'/'Damage' number, or set a 'State' string. For non-primitive attribute types use value.kind='raw'; use kind='nil' to DELETE the attribute. The read of the old value and the write are each pcall-guarded. WARNING: this mutates the running game on the client — the change takes effect immediately and may replicate, and game scripts listening on GetAttributeChangedSignal will fire. Returns { Path, Attribute, OldValue, NewValue, ok } or { error }. Signature: { instancePath: string, attributeName: string, value: { kind: "string" | "number" | "boolean" | "nil" | "raw", value: string | number | boolean? }, threadContext: number? }. Phase: act; cost=medium; idempotency=idempotent-write. Requires: active-client, resolved-target, explicit-mutation-approval. Produces: operation-receipt. Verify with: get-instance-properties. 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 |
|---|---|---|---|
| value | Yes | The new attribute value to write, expressed as a typed argument. | |
| instancePath | Yes | Luau expression resolving to the Instance whose attribute you want to set, e.g. 'game.Workspace.Part', 'game.Players.LocalPlayer', or 'game:GetService("Workspace").Boss'. Evaluated as `return <instancePath>`. | |
| attributeName | Yes | The exact attribute name to write, e.g. 'IsAdmin', 'Cooldown', 'State'. Case-sensitive. If the attribute does not exist yet it will be created; passing value.kind='nil' deletes it. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |