Lesson 1 of 6
Debugging: breakpoints, the console, a method
Debug a Roblox game like a pro. Pause Beacon Yard's server code on a breakpoint, read Watch and the Call Stack, use logpoints and the F9 Developer Console, and follow a repeatable method.
By the end you can
- Pause CombatService.trySwing on a server breakpoint and read Watch and the Call Stack
- Choose between a breakpoint, a conditional breakpoint and a logpoint for a noisy event such as Touched
- Read Output and the Developer Console and tell a Luau error from an engine content warning
- Follow a five-step method from symptom to a fix that a test keeps fixed
Before this: Client and server: who owns what, Playtesting: Play, Run, Team Test, server and client views
Step 1 of 12
A swing that does nothing
You swing the wrench at the drone. The animation plays, the sound plays, and the drone's health bar does not move. Nothing is red in Output. Somewhere between your click and the drone, a rule said no.
In Beacon Yard that rule lives in CombatService.trySwing, on the server. It returns one of three words: rejected, miss or hit. Your job is to find out which one it returned, and why.
function CombatService.trySwing(player: Player, origin: unknown, direction: unknown): string
if typeof(origin) ~= "Vector3" or typeof(direction) ~= "Vector3" then
return "rejected"
end
if not isFiniteVector(origin) or not isFiniteVector(direction) then
return "rejected"
end
if direction.Magnitude < 1e-3 then
return "rejected"
end
local character = player.Character
if character == nil then
return "rejected"
end
local tool = character:FindFirstChild("Wrench")
if tool == nil or not tool:IsA("Tool") then
return "rejected"
end
local head = character:FindFirstChild("Head")
if head == nil or not head:IsA("BasePart") then
return "rejected"
end
if (origin - head.Position).Magnitude > ORIGIN_MAX_STUDS then
return "rejected"
end
local now = workspace:GetServerTimeNow()
local previousSwing = lastSwing[player]
if previousSwing ~= nil and now - previousSwing < SWING_GAP then
return "rejected"
end
lastSwing[player] = now
feedback(player, "swing", nil)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = CollectionService:GetTagged(DRONE_TAG)
local result = workspace:Raycast(origin, direction.Unit * Config.WRENCH_RANGE, params)
The first line of the function checks the types of what the client sent. Seven more checks follow before the ray is cast. Any of them can end the swing quietly.
trySwing returns a string. Which value means a server check refused the swing before any ray was cast?
Press 1 to 4 to choose, Enter to check.
Step 2 of 12
Which side is paused?
Studio runs two simulations when you press Play: a server and a client1. A BreakpointBreakpointA mark on a line of code that pauses the script when that line is about to run.Think of it as a pause button glued to one line. pauses only the side that runs that line. trySwing is server code, so a breakpoint on it stops the server while your character, camera and HUD keep going on the client.
The viewport border tells you which view you are looking at: green for the server, blue for the client. Output labels each line the same way.
The server is the referee with the only real scoreboard. When you pause the referee, the players can still run around their screens. Nothing they do counts until the referee resumes.
Think of it as The referee with the only real scoreboard
Server sideRemember: The server is the referee with the only real scoreboard.
You set a breakpoint on the first line of CombatService.trySwing and swing. What happens?
Press 1 to 4 to choose, Enter to check.
Step 3 of 12
Pause on the line
You already met gutter breakpoints, Watch, Call Stack and the F10 / F11 / Shift+F11 stepping keys in Debugging basics: Output, stack traces and breakpoints. Here they pause a live server remote handler in trySwing.

Select a numbered pin, or a row below, to read what it marks.
A server breakpoint in trySwing. Watch has four expressions; two of them read Value not found.
In Watch2, origin already holds the Vector3 the client sent, while head is assigned further down the function and reads Value not found until you step past it. In Call Stack, trySwing sits above the Swing remote handler (a real player click) rather than tests/init.luau (a direct test call).
Paused on the first line of trySwing, you add (origin - head.Position).Magnitude to Watch. What does it show?
function CombatService.trySwing(player, origin, direction)
-- paused here
...
local head = character:FindFirstChild("Head")
Press 1 to 4 to choose, Enter to check.
Step 4 of 12
Step, then continue
Using the stepping keys from Debugging basics: Output, stack traces and breakpoints (F10 over, F11 into, Shift+F11 out, plus Resume)2, walk through a real wrench swing on the server:
A server breakpoint hit by a real wrench swing, then Watch, the Call Stack and Resume.
Transcript
- 0:01 The server breakpoint in trySwing hits when the wrench swings.
- 0:06 Watch shows the origin the client sent, and its magnitude. head reads Value not found. That local is not assigned yet.
- 0:14 The call stack is the Swing remote, then trySwing.
- 0:25 Continue, and the server runs again.
Build along
src/server/CombatService.luau
Open
CombatServicein Studio (synced fromsrc/server/CombatService.luau) and click in the gutter next to the first line insidetrySwing.You should see A red circle appears in the gutter next to the first line of trySwing.
Press Play, equip the wrench, and swing once.
You should see Play pauses on that line with a yellow arrow. The Call Stack lists trySwing above the Swing handler.
In Watch, add
origin,origin.Magnitudeandhead. Press F10 a few times and watchheadchange.You should see origin shows a Vector3. head reads Value not found until you step past the line that assigns it.
Press Resume, then Stop.
You should see The swing finishes and Play continues. Stop resets the place, but the breakpoint stays in the gutter.
Step 5 of 12
Touched fires a lot: use a logpoint
Some code runs dozens of times a second. CoinService's Touched handler fires for every body part that bumps the coin. A plain breakpoint there freezes the server on every foot, including all the touches that are fine.
Studio has three other gutter marks for this2:
- A conditional breakpoint pauses only when an expression is true, such as
(rootPart.Position - coin.Position).Magnitude > 12, the reject path. - A LogpointLogpointA breakpoint that writes a message to Output instead of pausing.Think of it as a print you add from the gutter, without editing the script. prints a message to Output and does not pause.
- A temporary breakpoint removes itself after one playtest.

Select a numbered pin, or a row below, to read what it marks.
A logpoint on line 126 writes each distance to Output and the game keeps running.

Select a numbered pin, or a row below, to read what it marks.
Right-click a breakpoint and choose Edit Breakpoint to give it a condition.
-- A touch is only a hint. Check the character's root is close
-- enough to the coin before paying.
local character = player.Character
local rootPart = if character then character:FindFirstChild("HumanoidRootPart") else nil
if rootPart == nil or not rootPart:IsA("BasePart") then
return
end
if (rootPart.Position - coin.Position).Magnitude > 12 then
return
end
seen[player] = true
Match each debugging goal to the gutter mark that fits it.
Step 6 of 12
Output, F9 and what a line is telling you
You already used Studio's Output window (print, warn and red errors) in Debugging basics: Output, stack traces and breakpoints3. The Developer Console opens with F9 or /console in any running session, including a published game, and adds Memory, Network and Script views4. In a live server only the owner and editors can read the server log.

Select a numbered pin, or a row below, to read what it marks.
F9 during Play. The lines in view name an asset and a service, not a script in src/.
Learn to read the shape of a line before its words:
- A Luau error names a script and a line:
ServerScriptService.Server.CombatService:162. That is your code. - An engine content warning names an asset id and no script. Often it is not your request at all; in Beacon Yard one comes from the default avatar.
- A game warning is text the game chose to write.
DataServicewarns once when the store is unavailable, then carries on.
local function warnOnce(message: string)
if warned then
return
end
warned = true
warn(message)
Match each Output line to what it most likely is.
Step 7 of 12
The command bar trap
The command bar runs Luau you type, on the server or the client. It also has its own require cache. If you require DataService from it, you do not get the running service; you get a second, fresh copy with no profiles. The HUD shows 85 coins and your command-bar copy says the player has no profile at all. You can see it yourself in a solo Play session. In the server command bar, game.Players:GetPlayers()[1] is the player Studio spawned, so this line asks the fresh copy about that player:
require(game.ServerScriptService.Server.DataService).get(game.Players:GetPlayers()[1])
It errors with No profile for and the player's name, even though the running game has a profile for them.
Beacon Yard avoids this by letting the server script require the test suite and expose a BindableFunctionBindableFunctionAn object that lets scripts on the same side call each other and get a result back.Think of it as an intercom between two rooms in the same building. called RunGameTests. Invoking it runs code inside the live server's cache.
-- The Studio command bar has its own require cache, so a test that
-- requires these services from the command bar would get a second,
-- empty copy. Requiring the suite here binds it to this script's cache.
-- Invoke ServerScriptService.RunGameTests from the command bar to run it.
local testModule = ReplicatedStorage:FindFirstChild("GameTests")
if testModule and testModule:IsA("ModuleScript") then
local runTests = require(testModule) :: () -> ()
local runner = Instance.new("BindableFunction")
runner.Name = "RunGameTests"
runner.Parent = ServerScriptService
During Play you run require(game.ServerScriptService.Server.DataService).get(game.Players:GetPlayers()[1]) from the server command bar. It errors with No profile. Why?
Press 1 to 4 to choose, Enter to check.
Step 8 of 12
Monitoring errors on live servers
Once players join a published experience, you cannot set a breakpoint on their server. Instead, open Creator Dashboard > Creations, pick your experience, and under Monitoring select Error Report5.
Error Report aggregates up-to-the-minute Luau errors and warnings from both servers and clients. Key tools on the page:
- Filters: narrow by Date range (1 hour to 30 days), Place, Severity, Platform, OS, Show version (marks each place publish on the chart) and New errors since (isolates regressions introduced in a specific version).
- Errors and warnings table: shows
Count,Severity,Type(server or client),Message,First seen atandFirst seen version. Expand any row with a dropdown to inspect its stack trace. - Custom rules: on the Rules tab, click Create Rule to match exact text or a regex and either Ignore unavoidable noise or Group related messages under one label.
To make live logs searchable and easy to group, write structured warnings with a fixed tag prefix and key=value fields instead of free-form sentences:
You just published version 48 of Beacon Yard. Which Error Report options help you spot errors that started only in version 48?
Press 1 to 4 to choose, Enter to check.
Step 9 of 12
A method you can repeat
Tools help only inside a method. Professionals use something close to this:
- Reproduce. Find the smallest steps that make the bug happen every time.
- Locate the side. Server or client? The colour of the Output line and the folder of the script tell you.
- Form one guess. "The origin is more than 8 studs from the head."
- Test the guess with one breakpoint, logpoint or print. Read the value; do not assume it.
- Fix and lock it in with a test that fails without your fix.
Step 5 is what separates debugging from guessing. The next two lessons show the tests that lock fixes in.
Other ways pros do this
| Option | What it is | When pros pick it | Trade-offs |
|---|---|---|---|
| Studio debugger | Breakpoints, Watch, Call Stack and stepping inside Studio. | Most server and client bugs you can reproduce in a playtest. | Pausing changes timing, so races can hide while paused. |
| print and warn | Text in Output, also visible in F9 on a live server. | Quick traces and anything you cannot pause, such as a live server. | Easy to forget in the code. Warnings can fail the playtest suite. |
| Error Report in the Creator Hub | Errors aggregated from live servers and clients. | Bugs players hit that you never reproduced. | Arrives after the fact and only shows the error, not the values. |
| Studio MCP and an AI assistant | Tools that start Play, run Luau and read Output for you. | Repeating the same reproduce-and-read loop many times. | It still needs your method; it will happily read the wrong log. |
Put the debugging method in order.
- Test the guess with a breakpoint, logpoint or print
- Form one guess about the cause
- Decide whether it happens on the server or the client
- Reproduce the bug with the smallest steps
- Fix it and add a test that fails without the fix
Step 10 of 12
Where the referee picture breaks
Where does it break?“The referee with the only real scoreboard” is a good picture of the server. Where does it stop being true?
It breaks here. The server is also the field itself, and it cannot see things that exist only on a client, such as a player's GUI or a LocalScript's effects.
The true model. The server runs the authoritative copy of the whole game world. Anything that matters (coins, damage, purchases) is decided there, and clients only see what it replicates to them.
The referee picture says the server sees everything that counts. That is true for coins and damage. It is false for the HUD: the label that says Coins 85 exists only on your client, so a server breakpoint can never show it, and a server log never mentions it.
The HUD shows the wrong objective text during Cooldown. Where should the breakpoint go?
Press 1 to 4 to choose, Enter to check.
Step 11 of 12
Challenges
Level 1, Apprentice
Challenge
Find the server log in the Developer Console and classify one line.
- Start from
- The game at milestone m06 (download)
Done means
- During Play you open the Developer Console with F9
- You switch between the client and server logs
- You name one line that is an engine warning, not a Luau error
Meet the criteria above, then record your own result. No test grades this check.
Why is a logpoint better than a standard breakpoint on CoinService's Touched handler?
Press 1 to 4 to choose, Enter to check.
Level 2, Builder
Challenge
Watch the coin distance check without freezing the game, then catch only the refused touches.
- Start from
- The game at milestone m06 (download)
Done means
- A logpoint in CoinService prints the distance on every touch
- A conditional breakpoint pauses only when the distance is over 12
- Both are removed or disabled afterwards
Meet the criteria above, then record your own result. No test grades this check.
Level 3, Professional
Challenge
The learner file pays 0 up close and 10 far away. Use a breakpoint to see which branch runs, then fix it. Run it from the server during Play:
game.ServerScriptService.RunGameTests:Invoke("debugging")
- Start from
- The game at milestone m04 (download)
- Grade it
- To grade work from an earlier milestone, apply your challenge changes to a checkout based on
m14-ship, which includes the Course Runner. In Studio, press Play, then rungame.ServerScriptService.RunGameTests:Invoke("debugging")in the server command bar. Copy the pass code from Output.
Done means
- challenges/debugging_branch.luau pays the coin value at 12 studs or closer
- It pays 0 past 12 studs and never doubles
- challenges/debugging.luau prints TEST PASS for all five cases
Step 12 of 12
Recap
Reference Debugger keys and windows
Breakpoints, Watch and Call Stack are in the Script tab and under Window, Debug2. debug.traceback is in the debug library6.
F10- Run the current line without entering functions.
F11- Enter the function on the current line.
Shift+F11- Finish the current function and pause in its caller.
F9 or /console- Logs, memory and network in a running session, including live servers.
debug.traceback(message?)- The call stack as a string, for when you cannot pause.
Recap
- A breakpoint pauses only the side that runs the line; server code means the green server view.
- Use logpoints and conditions on noisy events like Touched; read Watch and the Call Stack when paused.
- Debug with a method: reproduce, locate the side, guess, test the guess, then lock the fix in with a test.
The server is the referee with the only real scoreboard, until the server is also the field itself, and it cannot see things that exist only on a client, such as a player's GUI or a LocalScript's effects.
Queued for review
- You set a breakpoint on the first line of CombatService.trySwing and swing. What happens?
- Paused on the first line of trySwing, you add (origin - head.Position).Magnitude to Watch. What does it show?
- During Play you run require(game.ServerScriptService.Server.DataService).get(game.Players:GetPlayers()[1]) from the server command bar. It errors with No profile. Why?
- The HUD shows the wrong objective text during Cooldown. Where should the breakpoint go?