A kill brick is a part in your game that removes or kills a player when they touch it. It's useful for lava, hazards, out-of-bounds triggers, or arena boundaries. The script listens for collisions and then removes the player's character.
We'll build one step-by-step, from setting up the part to writing the Luau script.
Create the Part
Start in Roblox Studio with a blank place. In the Home tab, click Part under the Insert section. A new part appears in the Workspace.
In the Properties panel, name it something clear like KillBrick. Set its size so it's wide and easy to touch — try Size: (20, 1, 20) to make a flat platform. Position it where you want (for example, below your spawn area). Change its Color if you want it to look like lava or hazard material.
Leave CanCollide on so players can walk on it (or turn it off if you want invisible kills).
Add the Script
Click on your KillBrick part in the Explorer. Then in the Home tab, click Script under Insert. A new Script object appears inside the part. This is important: the script must be inside the part itself, not in ServerScriptService.
Double-click the script to open the editor and clear out the default code.
Write the Touch Detection Code
Paste this script into the editor:
local killBrick = script.Parent
local debounce = {}
local function onTouched(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and not debounce[player] then
debounce[player] = true
humanoid:TakeDamage(humanoid.MaxHealth)
task.wait(2)
debounce[player] = nil
end
end
end
killBrick.Touched:Connect(onTouched)Here's what each part does:
script.Parent points to the part the script is inside of. This is how the script knows which brick triggered it.
debounce is a table that prevents the same player from triggering the kill brick multiple times in quick succession. Without it, a player walking slowly across the brick could die twice.
hit.Parent:FindFirstChild("Humanoid") looks for a Humanoid object in the thing that touched the brick. If the Humanoid exists, we know it's a player character, not just a random part.
game.Players:GetPlayerFromCharacter() converts the character model to the actual Player object so we can track them in the debounce table.
humanoid:TakeDamage(humanoid.MaxHealth) instantly removes all health, killing the character. The character disappears from the game.
task.wait(2) sets a 2-second cooldown before the same player can trigger the brick again. You can adjust this value.
killBrick.Touched:Connect(onTouched) connects the function to the Touched event, so onTouched runs every time something touches the brick.
humanoid:TakeDamage(humanoid.MaxHealth) with hit.Parent:MoveTo(Vector3.new(0, 5, 0)) to teleport them to a safe spawn point.Test Your Kill Brick
Save your script and press F5 or click Run in the Home tab to start Play mode. Walk your character onto the KillBrick. Your character should disappear and respawn at the default spawn.
If it doesn't work, check:
- Is the script inside the part, not in ServerScriptService?
- Does the script have any red error lines in the Output window? (View → Output to see it.)
- Is your character actually touching the brick, or falling through it?
Customize Your Kill Brick
Change the debounce timer: Edit the task.wait(2) line. Use 0 for no cooldown, or a longer number to prevent spam.
Make it invisible: In Properties, turn off CanCollide and set Transparency to 1. Players won't see it, but it will still kill them.
Add sound or effects: Insert a Sound object into the KillBrick, then play it in the script with script.Parent.Sound:Play() before the player dies.
Damage instead of instant kill: Replace humanoid:TakeDamage(humanoid.MaxHealth) with humanoid:TakeDamage(25) to deal 25 damage instead of instant death.
Common Issues
Players don't die: Make sure the script is inside the part, not elsewhere. Also check that Humanoid is spelled correctly in the script — capital H, lowercase umanoid.
Script errors appear: Open the Output window (View → Output). Read the error line and check your code for typos. Common mistakes: missing colons, wrong capitalization, or broken variable names.
The brick kills me too fast/too slow: Adjust the debounce timer. Lower values mean faster re-triggering; higher values add safety delay.