luau_run
Run Luau code in Roblox Studio to get print/warn output, serialized return values, and line-numbered errors for queries and undoable one-off edits.
Instructions
Run Luau in Studio and get back print/warn output, the return value (Instances, Vector3, tables… are serialized) and errors with line numbers. Use for queries and one-off edits; changes are undoable (history action=undo). Code runs on Studio's main thread: in long loops call task.wait() every ~1000 iterations. Top-level return works.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "luau_run"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Luau source. Either code or file is required. | |
| file | No | Path to a local .luau file to run instead of inline code. | |
| studio | No | Optional. Target Studio (name substring, place id or id). Only needed when several Studios are open and none was selected. | |
| context | No | Datamodel to run in. Default: edit when not playing, otherwise server. | |
| timeout_s | No | Default 60, max 600. |