Service · inherits Instance
ScriptDebuggerService
Provides programmatic breakpoint management, execution control, and runtime inspection of Luau scripts during a playtest.
About ScriptDebuggerService
ScriptDebuggerService exposes the Roblox Studio Luau debugger for
programmatic use. It provides functionality for breakpoint management,
execution control, and runtime state inspection.
APIs in this class are currently in beta and are subject to breaking changes.
Breakpoint Propagation
Breakpoints set in the edit DataModel are set on the specific
script instance and do not propagate to clones, but they propagate to
corresponding scripts in play data models at the start of a playtest.
Breakpoints set in a play DataModel propagate to script clones in
the same data model and to corresponding scripts in other data models.
Parallel Threads
The behavior of this API with parallel Luau is undefined.
Methods 10
AddBreakpoint
(scriptInstance: LuaSourceContainer, breakpoint: Dictionary) → ScriptBreakpointResultPluginAdds a breakpoint to a script. If a breakpoint already exists on the same script and line, its data is replaced.Adds a breakpoint to the specified script. If a breakpoint already exists on the same script and line, its data is replaced with the new configuration.
Errors if the script instance or breakpoint argument is invalid.
ClearBreakpoints
() → ()PluginRemoves all breakpoints across all scripts.Evaluate
(expression: string, frameId: int? = nil) → ScriptEvaluateResultPluginEvaluates a Luau expression in a stack frame's context.Evaluates a Luau expression in the context of the specified stack frame, or globally if no
frameIdis provided.Errors if the expression has a syntax error or
frameIdis invalid.GetRootVariables
(frameId: int) → List<ScriptVariable>PluginReturns the root variables (locals, upvalues, globals) for a stack frame.Returns the root variables (locals, upvalues, globals) for the specified stack frame. Each variable includes a
VariablesReferencefield; if greater than0, pass it toGetVariables()to drill into children.Errors if
frameIdis invalid. Returns empty if theDataModelis not stopped at a breakpoint or exception, or when stopped viaPause().GetStackTrace
(threadId: int, startFrame: int? = nil) → DebugStackTraceResultPluginReturns the call stack for a paused thread.Returns the call stack for a paused thread, ordered innermost (current execution point) to outermost. Use
startFrame(1‑based) for paginated retrieval of large stacks.Errors if
threadIdorstartFrameis invalid.GetThreads
() → List<ScriptDebugThread>PluginReturns all paused Luau threads.GetVariables
(variablesReference: int) → List<ScriptVariable>PluginDrills into structured variables (tables,Instances).Drills into structured variables such as tables and
Instances. Pass aVariablesReferenceobtained from a script variable returned byGetRootVariables()or a previous call to this method.Pause
() → ()PluginRequests the debugger to pause at the next safe point.Requests the debugger to pause at the next safe point. This method is asynchronous and returns immediately. When the thread pauses,
OnStoppedfires with reasonScriptStoppedReason.Pause. Has no effect if already stopped.Only meaningful when the
DataModelis running during a playtest. CallingPause()while already stopped at a breakpoint has no effect.RemoveBreakpoint
(scriptInstance: LuaSourceContainer, line: int) → booleanPluginRemoves the breakpoint on the given script and line.Removes the breakpoint at the specified line in the given script. Returns
falseif no breakpoint exists on the line (no-op). Errors if the script instance or line number is invalid.SetExceptionBreakMode
(breakMode: DebugBreakModeType) → ()PluginControls when the debugger pauses on exceptions.Sets the exception break mode on all
DataModels. UseDebugBreakModeTypeto specify when the debugger should pause on exceptions.
Events 1
Resumed
ScriptDebuggerService.Resumed:Connect(function(threadIds))PluginFires when a previously paused thread resumes execution.Fires when a previously paused thread resumes. After this event, all
frameIdvalues,VariablesReferencevalues, and script variable objects from that thread are invalidated. Re-fetch them the next time theDataModelstops if needed.Avoid modifying the
DataModel, throwing unhandled errors, or calling async yielding functions inside this event handler.
Callbacks 1
OnStopped
(stopped: Dictionary) → ScriptResumeActionPluginThe primary callback for reacting to debugger pauses. Returns a resume action.
ScriptDebuggerService also has every member of Instance. Deprecated and Roblox-only members are hidden.
Reference text from the Roblox Creator Documentation, licensed CC BY 4.0, reorganized by rbxtoolshub.com · Studio 0.743.0.7431133.