[Beta] Studio Debugger Luau API

Key Takeaways

ScriptDebuggerService ships today in beta, giving plugins programmatic control over the Studio debugger. Set conditional breakpoints and logpoints, inspect the variables and call stack of stopped threads, and control script execution, all from Luau. Studio Assistant can now drive the debugger itself, setting breakpoints, running your game, and reading live runtime state to track down bugs that static code review can’t catch.

Try the new API in Studio.

Hi Creators,

We’re excited to announce the beta release ofScriptDebuggerService, a Luau API that gives you programmatic control over the Studio debugger.

Studio debugging has always been hands-on: click to set breakpoints, step through by hand, hover to read values. ScriptDebuggerService opens that whole workflow up to code. Build your own debugging plugins and tooling on the API, or let Assistant drive the debugger for you through the new debugging Skill. Both paths use the same API.

The API

ScriptDebuggerService lets your plugins:

  • Manage breakpoints and logpoints: Attach them to specific scripts, gate breakpoints behind a condition so they only fire in the state you care about, and print runtime values with logpoints that never pause execution.
  • Inspect stopped threads: Walk the call stack of any paused thread, read every variable in a frame (including nested tables) by scope, name, value, and type, and evaluate arbitrary Luau expressions against the paused frame.
  • Control execution: Decide how the debugger responds to each stop, step into, over, and out of calls line by line, and set exception break modes to halt automatically on errors.

Workflows This API Unlocks

  • Conditional bug hunting: Break only when a variable hits the bad state you’re chasing (num < 6, health < 0, a nil where you expected an instance), so you skip every healthy iteration and stop exactly where it goes wrong.
  • Non-invasive logging: Drop logpoints to print runtime values without editing your scripts, pausing the game, or leaving behind stray print() calls to clean up later.
  • Automatic exception triage: Break on every error, or only on the ones your code doesn’t catch, then dump the variables and call stack at the moment of failure. This is how you pin down the intermittent crash that only shows up one run in fifty.
  • Interactive inspection: Step through code line by line and evaluate Luau against a paused frame, REPL-style, to test a hypothesis or read a derived value without editing and re-running.

Examples

Add breakpoints and logpoints - Click to expand
local sds = game:GetService("ScriptDebuggerService")

-- Breakpoints pause execution when a line
-- is about to run. Conditionally break when
-- a condition is met (variable "num" < 6)

local breakpoint: ScriptBreakpoint = {
    Line = 1,
    Condition = "num < 6"
}

-- Logpoints do not pause execution. They
-- typically print a message to debug
-- without needing to edit scripts or stop.

local logpoint: ScriptBreakpoint = {
    Line = 2,
    LogMessage = "Hit breakpoint!",
    ContinueExecution = true
}

-- Attach the created breakpoint/logpoint
-- to specific scripts
sds:AddBreakpoint(workspace.Script1, breakpoint)
sds:AddBreakpoint(workspace.Script2, logpoint)
Inspect runtime state on a stop, with exception breaking turned on - Click to expand
local sds = game:GetService("ScriptDebuggerService")

-- Stop execution for EVERY error hit
sds:SetExceptionBreakMode(Enum.DebugBreakModeType.Always)

-- OnStopped is called whenever the
-- debugger pauses
sds.OnStopped = function(info: ScriptDebugStopped)
	-- Resume past non-error stops (e.g., breakpoints)
	if info.Reason ~= Enum.ScriptStoppedReason.Exception then
		return Enum.DebuggerResumeType.Resume
	end
	print("EXCEPTION:", info.ExceptionText)

	-- Find where the error happened and dump all the
	-- variables there to inspect the current state
	local stack = sds:GetStackTrace(info.ThreadIds[1])
	local vars = sds:GetRootVariables(stack.Frames[1].Id)
	for _, v in vars do
		print(string.format("%s = %s (%s)", v.Name, v.Value, v.Type))
	end
	return Enum.DebuggerResumeType.Resume
end

Full method lists, the ScriptBreakpoint schema, and every enum live in the ScriptDebuggerService documentation.

Debugging with Studio Assistant


With the new debugging Skill, Assistant can debug from your game’s live runtime state, not just from reading your code.

We’ve integrated ScriptDebuggerService into Studio’s Assistant with a new debugging Skill, and it changes what Assistant can do with a bug report.

Reading code only gets Assistant so far. Some bugs only become clear while the game is running: a variable turns nil on the third spawn, or a value drifts out of range mid-playtest. Until now, Assistant could reason about what should happen. Now, it can run the debugger and see what actually happens.

When you describe a bug, the Skill drives the whole loop on its own:

  1. Sets breakpoints and logpoints in the relevant scripts, gated behind conditions so they fire only in the state you care about.
  2. Runs your game and waits for the debugger to stop at the right moment.
  3. Inspects the live state, walking the call stack, reading variables, drilling into nested tables, and evaluating expressions against the paused frame.
  4. Finds the root cause by comparing what’s happening against what you expected, then proposes a fix grounded in what it observed.

Some things you can hand it:

  • “Players sometimes spawn without a weapon. Set breakpoints, find out why, and fix it.”
  • “Something errors a few minutes into a playtest. Break on the exception and show me the state at the crash.”

When your request looks like a debugging problem, Assistant applies this Skill automatically.

What’s Next

We’re excited to gather your feedback on this feature, hear your suggestions for future improvements, and keep improving how AI handles debugging workflows in Studio. Let us know what you run into and what you’d like to debug next.

Happy debugging,
The Roblox Studio Team

82 Likes

This topic was automatically opened after 10 minutes.

This is going to be awesome to integrate VSCode / IDE breakpoints directly into Roblox Studio!

23 Likes

Is it possible to set bookmarks in Roblox Studio, so I can navigate fast to a certain line in a certain script?

4 Likes

Hai, this is very good! Eventually we’ll be able to use External IDEs to debug scripts now. Does the MCP server support adding breakpoints and logpoints, or would it need a plugin and extension to debug externally? If the MCP server can do it, than external AIs and extensions could use it without any extra plugins.

2 Likes

Using ai to demonstrate this is a waste of time and silly, I would of much preferred seeing someone actually write it out and explain what each part does and why it needs to be handled as x. They can point out any quirks and also give a better description than ai will. But this is very good

9 Likes

Great update! Kind of unrelated, but in terms of interacting with Luau code, I also would love to see an LSP API, which can allow developers to know the current state of the code structure in terms of types. I made a feature request for something like this recently: Implement a System for Configuring the Language Server

It could also directly be integrated into Assistant, where it can analyze the code, the type errors, and suggest corrections to the user, or apply them by itself, without requiring parsing or additional data. AI can be greatly behind the updates to Luau sometimes, and that can cause incorrect typing suggestions. An API like this could allow the AI to correct itself, and allow other use-cases.

5 Likes

Yea, this would also be a great change! We should be able to programmatically check warnings and type errors so AI can fix it, and external IDEs can show type errors accurate to the current version of Studio, rather than depending on the extension being updated.

4 Likes

@JohnnyMorganz You should add this to Luau LSP! Being able to debug and inspect variables right in VSC would be awesome, and it may be possible now! :3

5 Likes

Yes, the Studio MCP server exposes an execute_luau tool which external agents can use to interact with this API.

5 Likes

This is pretty huge. Been messing with it some, also found a possible issue with the skill itself. Seems to claim that the ScriptDebuggerService is accessible via plugin contexts as well when in reality you need to use the execute_luau tool which runs in the mcp’s elevated context. Claude seems to trip up on this.

1 Like

Great update! It always felt awkward to switch from VSCode to Studio for debugging (doubly so when using roblox-ts).

1 Like

This is going good roblox is back with doing W updates imagin what can you do with this W update approved :check_box_with_check:

2 Likes

This update is real good, before for debugging you need to jump from VScode to Roblox studio and that was a waste of time. I just a bit confused that will the MCP servers support this? If it does that would be cool else we can create extensions and plugins for debugging and yeah finally getting adv. tools of other IDEs!!

Hi, this is great! Coolest update in a while, but there seems to be no way to let a user decide whether to resume/step?

yielding inside of OnStopped doesn’t work, so you can’t yield to wait for a user’s decision to step/resume, it’s just not supported, and there’s no resume/step API, the only way to resume/step is returning from OnStopped.

i did notice there is a way to get the variables in a stack frame with ScriptDebuggerService:GetRootVariables

is it possible to somehow intergrate this with ScriptContext.Error?

this is the primary method on how i am able to forward errors from my plugin, to Bugsink which is an error tracking dashboard