Execute Code in the Roblox Game Client
executeRuns Luau code in the active Roblox client as a fire-and-forget task, returning { scheduled: true } after scheduling without waiting for output or runtime errors.
Instructions
Execute Luau in the active Roblox client WITHOUT waiting for it to finish. The code is COMPILED FIRST via loadstring (a syntax error is returned cleanly as { error } and nothing runs), then handed to task.spawn so it runs on its own thread; this tool returns { scheduled = true } the moment the thread is started — it does NOT wait for completion and does NOT return the code's output, return value, or runtime errors. Use this for fire-and-forget side effects. When you need the value(s) your code produces, use run-luau or execute-and-wait instead. Requires loadstring and the task library (both guarded). Returns { scheduled = true } or { error }. Signature: { code: string, client: string?, agent: string?, threadContext: number?, timeoutMs: number? }. Phase: act; cost=medium; idempotency=contextual-write. Requires: active-client, explicit-mutation-approval, validated-source. Produces: operation-receipt. Verify with: assert-state. Safety: MUTATING; executes caller-selected behavior in the live client. On failure: inspect tool-schema for exact fields, defaults, constraints, and an invocation example.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The Luau code to execute in the Roblox client. Compiled with loadstring, then spawned on its own thread. This tool does NOT return output — use run-luau or execute-and-wait if you need data back. | |
| agent | No | Optional. A stable label for WHICH agent is calling when several share this MCP session (e.g. 'researcher'). Gives that agent its own fair scheduling lane, its own persistent VM on each game, and its own queue budget, so co-tenant agents don't starve or clobber each other. | |
| client | No | Optional. Run on a specific connected client — its clientId OR username — for THIS call only, overriding your session's select-client binding without changing it. Lets multiple agents drive different games at the same time; omit to use your session's selected client. | |
| timeoutMs | No | Optional per-call deadline in milliseconds; omit it to use the tool or server default. | |
| threadContext | No | Optional Roblox thread identity for this call; omit it to use the server default. |