PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.

5 min

The following techniques and tools can help you debug scripts and gain information about what went wrong.

Output Window

The Output window (ViewOutput) is a simple but powerful debugging tool. It displays errors captured from running scripts, messages from the Roblox engine, and user-defined messages/errors generated by print() and warn() commands.

The output can be customized as follows:

A
Filters output by type such as Error or Warning.
B
Filters output by context such as Client, Server, User Plugin, etc.
C
Filters output by the text entered into the field, for example an object name.
D
Clears all output messages from the window.
E
Controls the level of detail displayed for each output message.
  • Show Timestamp — Shows a detailed timestamp in HH:MM:SS.SSS format.
  • Show Context — Shows the message context such as Client or Server.
  • Show Source — If applicable, shows the associated script name and line number.
  • Show Tables Expanded by Default — For outputted tables, contents are expanded by default.
  • Show Memory Address for Tables — For tables, shows the internal memory address such as 0xb4f0417581144ec5.
  • Log Mode — Simplifies output by removing options such as expandable trees.

Debugger

The built-in debugger offers utilities commonly found in an IDE (Integrated Development Environment). It is enabled by default but can be toggled on or off through the Studio Settings menu.

Breakpoints

Breakpoints are checkpoints that pause or “break” the execution of your scripts at specific lines. You can use the pauses to inspect and debug your experience, watch variables, and inspect the call stack. Breakpoints are one of the most effective ways to debug functions, and therefore one of the most important debugging tools.

You can configure breakpoints to break only if certain conditions are met, to print a message to the Output window, and to run only on the client or server. You can also mix these configurations together to best suit your debugging needs.

For more information, see Breakpoints.

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:

  1. Click the Add Watch button from the Script Menu tab.
  2. In the prompt window that opens, type in the variable’s name and confirm.
  3. From the Watch window that opens — also accessible through ViewWatch you can monitor the variable’s value as you step through breakpoints.

Call Stack

The Call Stack window tells you exactly where code execution is when paused or at a breakpoint.

  1. Open the Call Stack window from the View tab.
  2. Step through breakpoints and notice how the stack reflects the order of operations. If the current breakpoint is inside a function, the following item in the stack shows the line where the function was called.

Command Bar

The Command Bar is a powerful debugging tool, allowing you to test out literally any script command while the experience is running. The command bar is available in both Studio (ViewCommand Bar) and in the Articles/Developer Console.

Production Debugging

When testing a live version of your experience, the following production-level tools can assist in debugging.

Developer Console

The Articles/Developer Console provides a wide array of details including client and server output, memory usage, network performance, and more.

Log Files

Whenever a script running on your computer prints or errors, that message is recorded in a log file. These files are located in different places depending on the operating system:

  • On Windows, type %LOCALAPPDATA%\Roblox\logs into the file explorer address bar and then sort the folder by date modified. Logs should have the format log_XXXXX followed by additional naming. All logs with the same XXXXX value are from the same Studio session.
  • On macOS, logs are in the directory ~/Library/Logs/Roblox. In the Finder, click the Go menu, select Go to Folder, type in that directory, and confirm.
Tags:
  • debugging
  • bugs
  • help