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.
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.
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.
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.
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.
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\logsinto the file explorer address bar and then sort the folder by date modified. Logs should have the format
log_XXXXXfollowed by additional naming. All logs with the same
XXXXXvalue 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.
You can inspect HTTP traffic coming from your PC with HTTP debugging tools like Fiddler. To use Fiddler with Studio, go to Tools → Options…, click the HTTPS tab, and check Decrypt HTTPS traffic.
Next, on the Roblox Studio side, set up the proxy as follows:
- Go to File → Settings….
- In the Network section, scroll to the bottom and check the box that reads ProxyEnabled.
- Set the ProxyURL text box to http://localhost:8888 (8888 is the default Fiddler port).
- Restart Studio and the proxy settings should go into effect.