Using the Lua Debugger

Using the Lua Debugger

10 min

The Lua debugger is a tool designed to give Roblox developers the same utilities as any developer expects from an IDE (Integrated Development Environment). It’s enabled by default, however it can be toggled on or off through Roblox Studio’s Settings menu.

What is a Debugger?

A debugger is a tool which helps developers check that their code is functioning properly. Some debugger functionality can be replicated with print() statements that verify when specific code executes, but a debugger lets you put breakpoints in your scripts without modifying the code. In addition, the application will stop at breakpoints, letting you inspect the state of the program and even the values of certain variables at that point.


Breakpoints are “checkpoints” within a script. If a breakpoint is set for a line of code, a running Roblox game will pause when it tries to execute that line.

To set a breakpoint within a script:

  1. Open a script inside Roblox Studio.
  2. Click to the left of any line where you want to pause execution of the script. This will create a red dot indicating a breakpoint.

Inspecting Breakpoints

You can see all of the breakpoints you’ve set by clicking on Breakpoints from the View tab. This will open the Breakpoints window where can enable/disable specific breakpoints (or all breakpoints), remove breakpoints, and see which script each breakpoint is in.

Stepping Through Code

When a script is paused at a breakpoint, you can continue executing the script line by line. This lets you closely monitor how variables are changed and which functions are called. There are three ways to step through code, all available from in the Script Menu tab:

Button Action Description
Step Into The Step Into button moves the debugger into the function on the current line. If there is no function on the current line, the debugger will move to the next line.
Step Over The Step Over button moves the debugger to the next line of code, not moving into functions.
Step Out The Step Out button moves the debugger out of the current function and to the next line of code after the function was initially called. If the current line is not inside a function, this button will move to the next line.

Watching Variables

You can also tell the debugger to “watch” variables, keeping track of their value when you hit breakpoints. To add a variable to the watch list, simply highlight it and click the Add Watch button from the Script Menu tab. This will open the Watch window where you can monitor the variable’s value as you step through breakpoints.

Call Stack

The Call Stack window, accessible from the View tab, tells you exactly where in your code the game currently is (when paused or at a breakpoint). If the current line of code exists inside a function that was called from another function, the stack will show the order in which the functions were called, along with the line number where the call was made.

  • debugging
  • bugs
  • tools