PPristone AcademyLearn · Mentor · Build
The Roblox Builder's Quest · Debugging · Mission 3 · +100 XP · ⏱ 25 min

The upgrade — and your first real bug.

You're about to hit a bug every Roblox developer hits — and fix it like a professional.

Win condition

A brick that deals exactly 20 damage, flashes red when it fires, and can't be spammed.

200,000 FT
The Big PictureBugs are the curriculum

Real games deal damage — and damage creates a problem worth having.

Instant kill is fun once. This mission switches to 20 damage per hit — and the moment you do, the game will misbehave in a way that teaches you more than ten tutorials.

30,000 FT
The BuildBreak it first, then fix it

Step 1: change one line. Step 2: watch it fail.

1

In your Mission 2 script, change the health line to:

humanoid.Health = humanoid.Health - 20
2

Play it. Walk into the brick. You died instantly anyway. Why?!

The bug

`Touched` fires dozens of times per second while you're in contact with the brick. 20 damage × 30 fires = dead. The fix is a debounce — a lock that says "I already fired, wait."

3

Replace the whole script with the fixed version:

local part = script.Parent
local damage = 20
local debounce = false

part.Touched:Connect(function(hit)
    if debounce then return end

    local humanoid = hit.Parent:FindFirstChild("Humanoid")
    if humanoid then
        debounce = true

        humanoid.Health = humanoid.Health - damage
        part.BrickColor = BrickColor.new("Really red")

        task.wait(1)

        part.BrickColor = BrickColor.new("Medium stone grey")
        debounce = false
    end
end)
4

Play. The brick now hits for exactly 20, flashes red for one second, then rearms.

UNDER THE HOOD · THE PATTERN
The UnderstandingHow a debounce works

The debounce, beat by beat.

1 · Armed

`debounce = false` — the trap is ready. The very first touch passes the `if debounce then return end` gate.

2 · Locked

`debounce = true` fires immediately. All the extra Touched events — the ones that were killing you — now hit the lock and bounce off.

3 · The pause

`task.wait(1)` pauses this function for one second while the rest of the game keeps running. Never freezes anything else.

4 · Rearmed

`debounce = false` — the trap resets, ready for the next victim. One hit per second, exactly as designed.

A debounce is the lockout on a game-show buzzer: the first press registers, then the buzzer goes dead for a moment so mashing it does nothing. Without it, one press counts thirty times.
0 FT · WHEELS DOWN
Repair Shop + DebriefIf it didn't work

The Repair Shop.

🔧 I still take damage 5 times from one touch

The debounce is missing or misspelled. Compare line by line — debounce = true must come before the damage line, and the variable name must match everywhere.

🔧 The brick fires once and never again

The `debounce = false` at the end never ran — usually because a line above it errored. Check Output for red text.

🔧 The color never changes back

Check the spelling: "Medium stone grey" — grey with an e. BrickColor names must match exactly.

Touched spams — always debounce

Any Touched handler that changes something needs a lock. You will use this pattern in Missions 4, 5, and every game you ever build.

task.wait pauses only this function

The game keeps running. That's what makes timed effects — flashes, cooldowns, respawns — possible.

Mission complete

+100 XP. You found a real bug, understood why it happened, and fixed it with the pattern professionals use. Mission 4 builds an economy.

THE UPGRADE · THE ROBLOX BUILDER'S QUEST · MISSION 3
Touched fires dozens of times a second · debounce = armed, locked, pause, rearmed · task.wait pauses only this function.
Next: the treasure — coins and a real score on the leaderboard.