Run Luau in Studio
execute_luauRuns Luau in Roblox Studio to access data, perform calculations, or call engine APIs that dedicated tools don't cover, returning printed or returned results.
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: 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.
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="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 |
|---|---|---|---|
| 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. | 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 only: how long the script may run. Defaults to 30. |