Runtime debugging with Roblox Studio MCP means you can inspect and instrument a live game session without ever pausing it. By combiningDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Chrrxs/robloxstudio-mcp/llms.txt
Use this file to discover all available pages before exploring further.
eval_server_runtime, log-breakpoints, get_runtime_logs, and capture_script_profiler, an agent can trace a bug from its first symptom—an unexpected value returned from the server—all the way down to the specific function consuming the most CPU, then apply a surgical fix and verify the result in the same session.
Full debug workflow
Start a playtest
Begin a solo playtest in Play mode. This launches the server and client peers and activates the runtime eval bridges inside the play DataModel.
Evaluate live state on the server
Use Call it as:
eval_server_runtime to inspect any server-side value while the game is running. This executes in the game Script VM and shares the same require cache as your game scripts, so module-level singletons are visible.eval_server_runtime runs inside the running game’s Script VM, giving it access to the same require cache as your game scripts. execute_luau target="server" runs in the plugin context with PluginSecurity permissions instead — it sees the live DataModel but does not share the game’s require cache. Use eval_server_runtime when you need to call into your own module singletons.Set a log breakpoint on the suspected function
Log breakpoints are the recommended agent debugging primitive. They print diagnostic output into the log buffer without stopping the playtest. Set the breakpoint on the line inside the function you want to instrument, providing a The tool prefixes all breakpoint log lines with
log_message expression."Breakpoint" followed by the script path and line number, making them easy to filter later.Reproduce the bug
Trigger the code path that contains the suspected bug. You can use input simulation tools to drive the game without manual intervention:Alternatively, use
eval_server_runtime to call the buggy function directly:Read the breakpoint logs
After reproducing the behavior, read the runtime log buffer and filter by In a standard solo playtest,
"Breakpoint" to isolate only the breakpoint output. This filter also catches any breakpoint-related Studio errors.LogService reflects logs across all peers, so you will see breakpoint output regardless of which target you read from. Use target="all" to merge all buffers.Profile if needed
If the breakpoint logs point to a hot code path, capture a Script Profiler sample to get precise CPU timing. Trigger the relevant workload first, then capture while it is running.The result includes
top_functions sorted by descending total_us. Look for your game module functions at the top of the list — native and plugin frames are excluded by default.Identify and label the hotspot
Identify the hottest function from Then re-capture with the same duration and a label filter:Custom
top_functions. If function names are too broad to isolate the specific culprit, add debug.profilebegin / debug.profileend labels around the suspected code path, then re-capture with a filter matching the label prefix.debug.profilebegin labels appear in both debug_labels and top_functions with their script source.Fix the script
Apply the fix using
edit_script_lines for surgical changes or set_script_source for a full rewrite. edit_script_lines requires old_string to match exactly once in the script; supply line_range to anchor it when the string appears more than once.Example: finding why a round never starts
A common real-world scenario for this workflow is diagnosing a game where rounds fail to begin. You can give an agent a prompt like:“Start a multiplayer test with 2 clients, read the server log, and tell me why the round never starts.”The agent will:
- Start a multiplayer playtest with
multiplayer_playtest action="start" numPlayers=2 force=true - Read
get_runtime_logs target="server"to look for error output or missing expected log lines - Use
eval_server_runtimeto inspectRoundService.stateor whatever holds the round lifecycle state - Set a log breakpoint on the round-start function to observe what values it receives when called
- Report back what condition is preventing the round from proceeding
execute_luau vs eval_server_runtime
Both tools can run code on the server peer during a playtest, but they operate in different contexts.| Tool | VM context | require cache | Use when |
|---|---|---|---|
eval_server_runtime | Game Script VM | Shared with game scripts | Calling into game module singletons, reading live service state |
execute_luau target="server" | Plugin context (PluginSecurity) | Separate from game scripts | Studio API calls, bypassing game security boundaries |
"Requested module experienced an error while loading" message from eval_server_runtime, the error is Roblox’s require() wrapper — the actual error text is preserved inside the message. Read it carefully rather than retrying blindly.