The upgrade — and your first real bug.
You're about to hit a bug every Roblox developer hits — and fix it like a professional.
A brick that deals exactly 20 damage, flashes red when it fires, and can't be spammed.
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.
Step 1: change one line. Step 2: watch it fail.
In your Mission 2 script, change the health line to:
humanoid.Health = humanoid.Health - 20Play it. Walk into the brick. You died instantly anyway. Why?!
`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."
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)Play. The brick now hits for exactly 20, flashes red for one second, then rearms.
The debounce, beat by beat.
`debounce = false` — the trap is ready. The very first touch passes the `if debounce then return end` gate.
`debounce = true` fires immediately. All the extra Touched events — the ones that were killing you — now hit the lock and bounce off.
`task.wait(1)` pauses this function for one second while the rest of the game keeps running. Never freezes anything else.
`debounce = false` — the trap resets, ready for the next victim. One hit per second, exactly as designed.
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.
Any Touched handler that changes something needs a lock. You will use this pattern in Missions 4, 5, and every game you ever build.
The game keeps running. That's what makes timed effects — flashes, cooldowns, respawns — possible.
+100 XP. You found a real bug, understood why it happened, and fixed it with the pattern professionals use. Mission 4 builds an economy.