Reference API Roblox

Engine API

Website

Related

Reference API Roblox

ScriptDebuggerService

Provides programmatic breakpoint management, execution control, and runtime inspection of Luau scripts during a playtest.

This class is not replicated. Its interface does not cross the network boundary.
This class is not creatable. Instances of this class cannot be created with Instance.new.
This class is a service. It is a singleton that may be acquired with GetService.
Tags: [NotCreatable, Service, NotReplicated]

Member index 12

HistoryMember
721AddBreakpoint(scriptInstance: LuaSourceContainer, breakpoint: Dictionary): Dictionary
721ClearBreakpoints(): null
721Evaluate(expression: string, frameId: int? = nil): Dictionary
721GetRootVariables(frameId: int): Array
721GetStackTrace(threadId: int, startFrame: int? = nil): Dictionary
721GetThreads(): Array
721GetVariables(variablesReference: int): Array
721Pause(): null
721RemoveBreakpoint(scriptInstance: LuaSourceContainer, line: int): bool
721SetExceptionBreakMode(breakMode: DebugBreakModeType): null
721Resumed(threadIds: Array)
721OnStopped(stopped: Dictionary): Dictionary
inherited from Instance
726Archivable: bool
726Capabilities: SecurityCapabilities
726IsInSandbox: bool
726Name: string
726Parent: Instance
726PredictionMode: PredictionMode
726Sandboxed: bool
726UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
726children(): Instances
726clone(): Instance
726destroy(): null
726findFirstChild(name: string, recursive: bool = false): Instance
726getChildren(): Instances
726isDescendantOf(ancestor: Instance): bool
726remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
726childAdded(child: Instance)
inherited from Object
726ClassName: string
726className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
726isA(className: string): bool
647Changed(property: string)

Description

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.

History 13

Members 12

AddBreakpoint

Parameters (2)
scriptInstanceLuaSourceContainer
breakpointDictionary
Returns (1)
Dictionary

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.

History 1

ClearBreakpoints

Parameters (0)
No parameters.
Returns (1)
null

Removes all breakpoints across all scripts.

History 1

Evaluate

Parameters (2)Default
expressionstring
frameIdint?nil
Returns (1)
Dictionary

Evaluates a Luau expression in the context of the specified stack frame, or globally if no frameId is provided.

Errors if the expression has a syntax error or frameId is invalid.

History 1

GetRootVariables

Parameters (1)
frameIdint
Returns (1)
Array

Returns the root variables (locals, upvalues, globals) for the specified stack frame. Each variable includes a VariablesReference field; if greater than 0, pass it to GetVariables() to drill into children.

Errors if frameId is invalid. Returns empty if the DataModel is not stopped at a breakpoint or exception, or when stopped via Pause().

History 1

GetStackTrace

Parameters (2)Default
threadIdint
startFrameint?nil
Returns (1)
Dictionary

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 threadId or startFrame is invalid.

History 1

GetThreads

Parameters (0)
No parameters.
Returns (1)
Array

Returns all paused Luau threads. Should be called when the DataModel is stopped (typically inside OnStopped). Returns empty results when the DataModel is not stopped at a breakpoint or exception, or when stopped via Pause().

History 1

GetVariables

Parameters (1)
variablesReferenceint
Returns (1)
Array

Drills into structured variables such as tables and Instances. Pass a VariablesReference obtained from a script variable returned by GetRootVariables() or a previous call to this method.

History 1

OnStopped

Parameters (1)
stoppedDictionary
Returns (1)
Dictionary

The primary mechanism for reacting to debugger pauses. Set this to a function that receives a stopped payload and returns a script resume action dictionary indicating how execution should continue.

Only one OnStopped per DataModel is allowed; it is not inherited from the edit DataModel.

If the callback returns nothing or throws, DebuggerResumeType.Resume is assumed. Avoid modifying the DataModel, throwing unhandled errors, or calling async yielding functions inside this callback.

Late-Set Behavior

If OnStopped is set while the DataModel is already stopped at a breakpoint and the previous value was nil, the callback runs immediately.

History 1

Pause

Parameters (0)
No parameters.
Returns (1)
null

Requests the debugger to pause at the next safe point. This method is asynchronous and returns immediately. When the thread pauses, OnStopped fires with reason ScriptStoppedReason.Pause. Has no effect if already stopped.

Only meaningful when the DataModel is running during a playtest. Calling Pause() while already stopped at a breakpoint has no effect.

History 1

RemoveBreakpoint

Parameters (2)
scriptInstanceLuaSourceContainer
lineint
Returns (1)
bool

Removes the breakpoint at the specified line in the given script. Returns false if no breakpoint exists on the line (no-op). Errors if the script instance or line number is invalid.

History 1

Resumed

Parameters (1)
threadIdsArray

Fires when a previously paused thread resumes. After this event, all frameId values, VariablesReference values, and script variable objects from that thread are invalidated. Re-fetch them the next time the DataModel stops if needed.

Avoid modifying the DataModel, throwing unhandled errors, or calling async yielding functions inside this event handler.

History 1

SetExceptionBreakMode

Parameters (1)
breakModeDebugBreakModeType
Returns (1)
null

Sets the exception break mode on all DataModels. Use DebugBreakModeType to specify when the debugger should pause on exceptions.

History 1

Settings