The Debug Loop is a structured, iterative workflow for diagnosing and resolving Roblox game bugs. Rather than making a single guess, it methodically collects the raw error output, reads the relevant source code, categorizes the root cause, generates a focused fix, and retests — repeating up to five times before escalating to you with a detailed findings report. Use this workflow whenever a script error appears in the Output panel or a playtest produces unexpected behavior. Trigger: You report an error, paste a stack trace, or ask Claude to “fix this bug” / “debug my game” / “something is broken”.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/brockmartin/roblox-game-skill/llms.txt
Use this file to discover all available pages before exploring further.
Error Gathering
Claude collects the raw error output before attempting any fix.Claude records four data points for each error:
- Full Mode
- Standard Mode
- Offline Mode
Calls
get_playtest_output to retrieve runtime errors from the most recent playtest session. Falls back to get_console_output if no playtest is active.- Exact error string (e.g.,
ServerScriptService.CombatHandler:42: attempt to index nil with 'Character') - Script path and line number
- Whether the error fires once, intermittently, or in a loop
- Whether the origin is server-side or client-side
Code Discovery
Claude locates and reads the source code surrounding the error.Claude reads 10–20 lines of surrounding context around the error line and traces the require chain for any modules that feed data into the failing function.
- Full Mode
- Standard Mode
- Offline Mode
Uses
grep_scripts with keywords extracted from the error (function names, variables, service names) to find all relevant scripts. Reads each with get_script_source.Root Cause Analysis
Claude categorizes the error into one of five buckets and selects the appropriate fix pattern.
Common nil-reference causes in Roblox:
| Category | Common Signs | Fix Pattern |
|---|---|---|
| Syntax Error | Missing end/then/do, mismatched brackets, typo in keyword | Correct the token; Luau’s error message usually points directly at it |
| Runtime Error | attempt to index nil, type mismatch, missing service | Add nil guards, type checks, or WaitForChild with timeout |
| Logic Error | No error thrown but wrong behavior; incorrect calculation or inverted conditional | Trace data flow with print statements to find where actual values diverge from expected |
| Security Issue | Client sending unvalidated data, damage computed client-side | Move authority to server; validate every remote argument |
| Performance Issue | FPS drop, memory climb, runaway Heartbeat loop | Profile with MicroProfiler, pool objects, debounce events |
Player.Characteraccessed before the character has loadedFindFirstChildreturningniland the result used without a guard- A RemoteEvent payload that the client did not send
WaitForChildtiming out and returningnil(with timeout argument)
Generate Fix
Claude produces corrected Luau code. Every fix includes three parts:Fix guidelines Claude follows:
- What was wrong — a plain-language explanation of the bug
- Why the fix works — the specific change and reasoning
- The corrected code — the full function or block, not a one-line diff
- Preserve the original code’s style and naming conventions
- Do not introduce unrelated refactors in the same fix (keep diffs minimal)
- If the bug appears in multiple scripts, note all locations
Apply and Retest
Claude applies the fix and immediately retests.
- Full Mode
- Standard Mode
- Offline Mode
execute_luau— inject corrected source into the sessionstart_playtest— launch a new testget_playtest_output— capture output and check for the original error
Verify and Iterate
Claude scans the full output — not just for the original error string — to catch any newly introduced issues.If the error is gone: Proceed to the summary step.If the error persists or a new error appears: Capture the updated diagnostic data and return to Step 1 with a new iteration. Each iteration is appended to a running log:
What to Do After 5 Failed Attempts
If five iterations do not resolve the bug, Claude provides:- A numbered log of every hypothesis, fix attempt, and result
- The current error state and suspected remaining causes
- Concrete manual investigation steps:
- Enable MicroProfiler (
Ctrl+F6) to identify frame spikes - Add
print()statements at key data boundaries to trace actual values - Isolate the failing logic in a minimal, empty Roblox place to rule out interactions
- Check the Developer Console (
F9) for errors that do not appear in the Studio output panel
- Enable MicroProfiler (
For bugs rooted in security patterns (client-trusted logic, unvalidated remotes), see Security Hardening for the full validation and rate-limiting patterns. For performance-related bugs (FPS drops, memory leaks), the Performance Audit workflow covers profiling in more depth.