Run Luau in Studio
execute_luauRun Luau code in Roblox Studio's plugin context and capture printed, returned, or thrown output for tasks no dedicated tool exposes.
Instructions
Runs Luau in Studio's plugin context and returns whatever it printed, returned, or threw.
This is the escape hatch. Reach for it only when no dedicated tool fits — create, modify, delete, move, script_edit and find validate their input, type values from the live API dump, and wrap writes in an undo recording. Code run here does none of that, so a typo becomes a runtime error instead of a suggestion, and changes it makes may not be undoable as one step.
Good uses: reading something no tool exposes, a one-off calculation over many instances, or calling an engine API the tools do not cover.
Output printed while it runs is captured and returned, so print is a reasonable way to get values out. return works too, including returning a table — it comes back as a structure, not a summary. There is no timeout for target="studio": an infinite loop will hang Studio until it is force-quit.
Against a running playtest server, Studio disables loadstring, so the code is compiled through a ModuleScript instead and runs at script identity — plugin-only APIs are unavailable there. When that happens it is stated in the result rather than left to be inferred from a failure.
With target="studio", do not use require to read live state out of a running game. This runs in the plugin's own Luau VM with its own module cache, so require here returns a second, freshly-initialised copy of the ModuleScript — its counters and caches read as empty while the real one is running fine, and a zero is indistinguishable from a genuine zero. Read live state off the DataModel instead (instances, attributes, properties), or have the game print it and read that with console. The result warns when a call could have hit this.
target="client" runs in the selected player's actual playtest client VM, including its live require cache. Requires a running playtest server studioId. Output is capped at 200 lines, 10 returns, table depth 4 and 50 entries. The relay is removed on completion or timeout; non-yielding code can still stall the client. Connections/hooks created by the temporary relay (such as Connect or RenderStepped) do not persist after the call returns.
target="live" runs the script on Roblox's servers against the PUBLISHED place instead, with no Studio involved. That is how you read or repair production: a real player's data store entry, what the live game actually holds, a migration over saved data. Everything the script prints comes back in logs.
BE CAREFUL WITH IT. The Studio path has an undo stack and a place nobody is playing. This one touches live data and live players, and nothing here can put any of it back — so it needs confirm: true and you should read before you write. Roblox queues it as a task, so expect seconds, not milliseconds, and a state of COMPLETE or FAILED rather than a bare value.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| player | No | client only: player name; required with multiple players. | |
| source | Yes | Luau to run. In an editor session this has plugin permissions, so `game`, `workspace` and plugin-only APIs are all reachable. | |
| target | No | 'studio' runs in the connected Studio, with plugin permissions. 'live' runs on Roblox's servers against the published place — production, with no undo. 'client' runs in a player's playtest client VM. | studio |
| confirm | No | Required for target="live". This runs against the game people are playing and nothing here can undo it. | |
| placeId | No | live only: which place. Omit to use `cloud place`. | |
| studioId | No | Target Studio; omit for the active one. | |
| universeId | No | live only: which game. Omit to use `cloud universe`. | |
| timeoutSeconds | No | live/client only: timeout in seconds. Defaults to 30. |