Roblox Debugging and Testing
When to Load
Any bug hunt or test work: errors, wrong behavior, "works in Studio, broken live", flaky or lying tests, CI test runs. The Studio MCP playtest loop, console reads, captures and subagent unit_test mode: roblox-studio-mcp. Frame time and memory: roblox-performance. "Is the fix live?": roblox-publish-checklist. CI wiring and runner exit codes: roblox-tooling §4.
"Field-observed" = seen in the owner's projects.
Traps and review checklist (symptom -> cause -> fix)
- Bug only on live servers, never in Studio -> a Studio playtest runs server and client on one machine: no real round trip, no live server load, no replication queued behind many players, no real phone. A clean Studio run proves nothing about a live-only bug, so don't start by reproducing it in Studio. Get evidence from a live server and client first: timestamps on the real path, the live Developer Console, the server MicroProfiler (§1). Simulate only afterwards, to test a fix.
- Network Simulator didn't reproduce it -> it adds only latency, jitter and packet loss to Studio playtest connections. Not server CPU load, player count or phone speed. Zero it for a baseline (
roblox-studio-mcp§3). - A Studio test changed real player data -> with Enable Studio Access to API Services on, Studio reads and writes the live game's DataStores, and places in one game share them. Test in a separate game under the same group. Studio DataStore calls also get separate, possibly lower, static limits: test throttling in Team Create.
- MemoryStore bug won't reproduce in Studio, or Studio hits quota -> Studio memory stores are isolated from production (
TESTscope). Quotas that scale with players are tiny with one tester, and Studio adds latency and errors from access checks. Debug the live store with the Developer Console. - Teleport or server-type logic differs in Studio -> tests support only
TeleportAsync. In Test,JobIdandPrivateServerIdare always empty; in Team Test every server is private; VIP teleports andGetPlayerPlaceInstanceAsyncfail. - Paused the playtest, scripts kept running -> Pause stops physics, animations,
PreAnimation,PreSimulation,PostSimulationandSteppedonly. Scripts,Heartbeat,PreRenderandRenderSteppedkeep running. Freeze code with a breakpoint. - Only on mobile -> the Device Simulator emulates screen, DPI and touch, not a phone's CPU or memory. Profile a real phone: set MicroProfiler to On in its Settings, then open the shown IP:port from a browser on the same network.
- Live Developer Console shows no server log -> the Server view needs edit permission (owner or group editors). Its command bar runs with normal script security, not Studio command bar rights.
- Custom error logger misses errors ->
ScriptContext.Errorfires only for unhandled errors (not insidepcall) and never forScript timeoutwatchdog kills. Engine messages such as asset load failures didn't reach a custom logger (field-observed): read each client's F9 log too. - Error Report lacks a new error -> it tracks a capped number of unique messages (Limits); group or ignore noise with rules (Error Reporting API).
- Intermittent, can't reproduce -> ship targeted logs (summary lines, stable prefix) and wait for the next report; don't guess a fix.
- Tests pass, game broken -> handler-only tests skip the client sender. A nil index early in a client action stopped every hit reaching the server while server tests passed (field-observed). Run one action of each kind through the real client and read the client error log.
- Breaks on the 2nd or 3rd use, tests green -> tests start fresh. Fire each tool 5+ times, including after reload, stow and draw, and swap. Start timer tests on a cooldown's last frame, and log every server rejection with its reason (field-observed).
- Flaky test -> hidden time, randomness or order: inject
nowand a seededRandom, sort dictionary keys before weighted picks, and wait on a condition with a deadline, not a fixed sleep. Never hide flakes behind an unconditional retry. TestServicethrows -> its APIs work only in a Studio playtest (Test, Test Here, Run) or on a Team Test server. Edit mode, the command bar while editing, and live servers throw. Guard:if not TestService.Enabled then return end.- CI green, nothing tested -> a filter typo makes
RunTestsAsyncreturnEnum.TestRunStatus.NoTests. Pass only onStatus == Enum.TestRunStatus.PasswithTotal > 0.
Limits
| Item | Value |
|---|---|
| Server MicroProfiler (live, Developer Console, edit permission) | max 60 frames, max 4 s delay |
| Mobile MicroProfiler web UI | last 30 frames; <ip:port>/90 for more |
| Error Report tracking | 500 unique errors + 500 warnings, top 100 new errors per version, reset every 6 h |
| Error Reporting API | 60 requests/min per key; universe.analytics:read (:write for rules) |
LogService:GetLogHistoryAsync |
Team Test only, last 512 messages, yields and can error |
Server & Clients, StudioTestService (plugin-only) |
up to 8 clients; one multiplayer test per Studio |
TestService test timeout |
30 s default (0-86400, 0 = none) |
1. Live-only bugs (the order that works)
- Instrument the real path. Log
workspace:GetServerTimeNow()at client fire, server receive, server apply, and client display, plusgame.JobIdand the player. Compare the gaps with the ping on the Developer Console's shortcut bar. A gap near ping is the round trip: fix with client-side feedback or prediction (roblox-networking). A gap well over ping is the server: look at its frame time. - Profile a busy live server. Desktop client in a game you can edit: Ctrl+F9 -> MicroProfiler -> Server, then Begin server recording during the repro. Script Profiler (Server) and Memory tabs sit beside it (
roblox-performance). - Read the Error Report filtered by version and platform.
- Only then reproduce the suspected condition in Studio (Network Simulator, several clients, a long session) to test a fix, and confirm the fix live.
Logs: label code for the MicroProfiler with debug.profilebegin/debug.profileend. Never drive game logic from log events (the docs call them unreliable and possibly truncated).
2. Where to look
- Team Test: Output Sources shows collaborators' client output (not the server's).
LogService:GetLogHistoryAsync(player.User)reads a collaborator's history;User.fromId(0)reads the server's. - Structured logs :
LogService:GetLogger("Combat"), nested with:GetLogger("Damage"). Messages take{key}placeholders plus a context table, and a logger'sMessageOutfires on every ancestor. Hold a reference to each logger: one with no references is reclaimed and errors when called. - Debugger from an agent: the Studio MCP
rbx-debugskill (ScriptDebuggerService;OnStoppedmust be set on each play DataModel). Latency:rbx-network-simulator. Devices:rbx-device-simulator-lua. Profiling:rbx-perf-profiling. - Code coverage :
ScriptContext:EnableCoverage(root)thenGetCoverageStats(). NeedsPluginOrOpenCloud(plugin, MCP or Luau Execution), not game scripts.
3. Tests: what's current (checked 2026-11-29)
| Tool | Status | Runs where |
|---|---|---|
TestService |
built into the engine | Studio playtest or Team Test server only |
Jest Roblox (Roblox/jest-roblox, Wally roblox/jest 3.21.0) |
Roblox's maintained Jest 27 port | inside Roblox only: Studio or Open Cloud Luau Execution; not Lune |
jsdotlua/jest-lua |
last release 3.10.0 (2024-12) | migrate to roblox/jest |
| TestEZ | archived 2024-03 (v0.4.2) | keep only where a project already uses it |
| Lune 0.11.1 (2026-10) | standalone Luau runtime | pure modules only, no engine; quirks in roblox-tooling §5 |
Studio MCP rbx-unit-test |
uses Jest or TestEZ if present, else its own harness | server DataModel during Play; no client-only APIs |
- Jest Roblox: require every global from
JestGlobals(describe,itandexpectaren't implicit). Matchers are dot calls:expect(x).toBe(y). The entry point isJest.runCLI(root, options, { projects }):awaitStatus(). The roblox-cli runner in its docs is Roblox-internal. TestService:test:Checkrecords and continues,test:Requirestops the test. Tables compare deeply, NaN never equals, Instances compare by identity.NamePatternis a plain substring, and only one run can go at a time. Checks made after a test ends are ignored, so a check in a thread that outlives its test doesn't count. A timed-out test leaves its spawned threads running.- Luau Execution in CI: physics doesn't run and place scripts don't start, so your script must require what it tests. DataModel changes aren't kept, but DataStore calls hit real data: use a test game. Whether
TestService.Enabledis true in a task isn't documented, so check it at runtime. Return counts and gate on them (roblox-tooling§4).
