How To Make A Kill Brick In Roblox Studio
Build instant kill bricks and damage-over-time hazards in Roblox Studio using Touched, ForceField-safe TakeDamage, and CollectionService tags.
- Difficulty
- Beginner
- Time Needed
- 10 To 15 Minutes
- Required Part Properties
- Anchored = true, CanTouch = true
- Instant Reset Method
- humanoid.Health = 0 (Bypasses ForceField)
- Spawn-Safe Method
- humanoid:TakeDamage(amount) (Blocked By ForceField)
- Multi-Brick Scaling
- One Server Script + CollectionService Tag
Configure The Hazard Part Before Scripting
Before writing any Luau code, set up the physical properties of the hazard block so players can recognize it immediately and collision detection works reliably. Insert a Part into Workspace, give it a distinct visual cue such as bright red Color paired with Neon Material, and lock Anchored to true so it stays fixed in place.
Check two collision settings in Properties depending on how the obstacle should feel. Leave CanTouch enabled—disabling CanTouch stops the Touched event from firing altogether. For solid lava floors, keep CanCollide enabled; for walk-through laser beams that trigger on contact without blocking movement, uncheck CanCollide while leaving CanTouch checked.
Create A Simple Single Kill Brick Script
For a quick prototype with one trap, insert a server Script directly inside the Part and connect to its Touched event. Using FindFirstAncestorOfClass("Model") rather than checking only otherPart.Parent catches both character limbs and wearable Accessories whose Handle sits one layer deeper inside the avatar hierarchy.
local hazard = script.Parent
hazard.Touched:Connect(function(otherPart)
local character = otherPart:FindFirstAncestorOfClass("Model")
if not character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid and humanoid.Health > 0 then
humanoid.Health = 0
end
end)Choose Between Health Zero And TakeDamage
Roblox provides two distinct ways to injure or defeat a Humanoid, and picking the wrong one causes subtle bugs near spawn points. Setting humanoid.Health = 0 bypasses every ForceField completely, instantly resetting the character even while spawn protection is active. That makes Health = 0 ideal for abyss floors and obstacle course beams where players should reset immediately on contact.
Calling humanoid:TakeDamage(amount) respects active ForceFields, dealing zero damage until spawn immunity expires. Use TakeDamage() for hazards near a SpawnLocation or gradual lava pools that chip away health over time. Because Touched fires dozens of times per second as feet and legs move across a brick, always pair partial TakeDamage() hits with a per-humanoid cooldown timer using os.clock() so a 25-damage trap does not empty a 100-health bar in one frame.
Scale To Dozens Of Hazards With CollectionService
Copying a brick along with an embedded Script fifty times across an obstacle course turns every minor tweak into fifty manual edits. Official Roblox architecture recommends tagging every hazard part with a shared string—such as KillBrick—inside the Tags section at the bottom of the Properties window, then controlling all of them from one Script inside ServerScriptService.
The CollectionService manager below binds every existing and newly streamed KillBrick part and disconnects listeners cleanly if a tag is removed. By default, tagged parts trigger an instant reset; adding a numeric Damage attribute (and optional Cooldown attribute) in Properties turns any individual brick into a ForceField-safe damage-over-time hazard without editing a single line of code.
local CollectionService = game:GetService("CollectionService")
local TAG_NAME = "KillBrick"
local connections: { [Instance]: RBXScriptConnection } = {}
local lastHit: { [Humanoid]: number } = {}
local function bindHazard(instance: Instance)
if not instance:IsA("BasePart") or connections[instance] then
return
end
connections[instance] = instance.Touched:Connect(function(otherPart)
local character = otherPart:FindFirstAncestorOfClass("Model")
if not character then
return
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health <= 0 then
return
end
local damage = instance:GetAttribute("Damage")
if typeof(damage) == "number" and damage > 0 then
local cooldown = instance:GetAttribute("Cooldown")
local delaySec = if typeof(cooldown) == "number" then cooldown else 0.75
local now = os.clock()
if lastHit[humanoid] and (now - lastHit[humanoid]) < delaySec then
return
end
lastHit[humanoid] = now
humanoid:TakeDamage(damage)
else
humanoid.Health = 0
end
end)
end
local function unbindHazard(instance: Instance)
local conn = connections[instance]
if conn then
conn:Disconnect()
connections[instance] = nil
end
end
for _, tagged in CollectionService:GetTagged(TAG_NAME) do
bindHazard(tagged)
end
CollectionService:GetInstanceAddedSignal(TAG_NAME):Connect(bindHazard)
CollectionService:GetInstanceRemovedSignal(TAG_NAME):Connect(unbindHazard)Fix Common Kill Brick And Touch Detection Bugs
When a kill brick ignores players during testing, check four settings right away. First, verify that the code sits in a server Script rather than a LocalScript—authoritative health changes belong on the server so every player sees the reset consistently. Second, make sure CanTouch is checked on the hazard part.
Third, note that Touched only fires when physical motion creates contact: if a moving kill beam is driven strictly by CFrame or TweenService and passes through a stationary avatar, physics touch events can occasionally miss. For fast-sweeping traps, combine Touched with periodic Workspace:GetPartsInPart() checks, or keep the trap thicker than one frame of travel. Finally, ensure the CollectionService tag spelling matches TAG_NAME exactly, including capitalization.