We use cookies on this site to enhance your user experience

Testing and Debugging Games

Testing and Debugging Games

5 min

It’s not always possible to write functional scripts the first time, or even figure out the problem by looking at them. Sometimes you need to “debug” a script by using techniques and tools which provide more information about what went wrong.

Test Modes

Run

Pressing the Run button in Studio simulates a Roblox server running your game without any players. This is useful if you want to quickly test how your game starts up and runs scripts that don’t involve players.

Pros Cons
  • Tools: Output window, Command Bar, Explorer/Properties
  • Fast and simple
  • No output lost
  • Server-side only
  • No Player or Player/Character|Character

Play

Pressing the Play or Play Here button in Studio simulates a server running with a single player that you control. This is useful for quickly testing player actions in your game.

Pros Cons
  • Tools: Output window, Command Bar, Explorer/Properties
  • Launches fairly quickly
  • Studio edits not lost on crash
  • One Player and Player/Character|Character
  • Local only
  • Player simply named "Player"

Start

Pressing Start in the Test tab of Studio creates a simulated server much like Run does. With Start, however, you can also specify the number of generic players to add to the game. A new instance of Studio will launch for each player, and one for the server. This mode very closely simulates your game running on Roblox and is ideal for testing multiple player interactions and client-server features like RemoteEvent|RemoteEvents.

Pros Cons
  • Tools (server only): Output window, Command Bar, Explorer/Properties
  • Most like online mode
  • Studio edits not lost on crash
  • Multiple Player|Players and Player/Character|Characters
  • LocalScript|LocalScripts have no tools

Tools

Roblox has a number of debugging tools that can help you analyze failing (or working) scripts.

Output Window

The Output window is one of the most powerful debugging tools. It displays any errors captured from running scripts, messages from Roblox game code, and user-defined messages and errors. It can be useful to include print() calls at key places in your scripts so you can see messages in the Output window.

To open the Output window in Studio, click on the View tab and then on Output.

Lua Debugger

Like most IDEs, Roblox Studio includes a Articles/Lua debugger you can use to pause a script so you can inspect it while it is running. This allows you to stop a script at specific points and run it step by step to see how it behaves.

Command Bar

The Command Bar in Studio provides a powerful debugging tool. It allows you to test out possible script commands and to make adjustments to the game while it’s running.

Explorer/Properties

The Explorer and Properties windows can be used in Studio to see what objects exist at a given time. This can help you see if certain properties were inadvertently changed by a script.

Log Files

Whenever a script running on your computer prints or has an error, 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:
  • bugs
  • help