Master the Kill: How to Make a Kill Part in Roblox Studio
To make a Kill Part in Roblox Studio, place a Part in your level, add a server-side Script beneath it, and use the Part’s Touched event to find and defeat a player’s Humanoid. The setup below includes a player-only check, a simple cooldown, and a ForceField check so the trap will not remove spawn protection.
This Roblox kill brick works for obbies, hazard rooms, and other experiences where touching a surface should reset a player. You can also make the part invisible or adapt it to damage players instead of eliminating them.
Before you build the kill brick
- Open Roblox Studio and create a new place or open an existing one.
- Make sure the Explorer and Properties panels are visible. You can enable them from Studio’s View menu if they are hidden.
- Use a test place or a private copy while you build and playtest the trap.
The script belongs inside the hazard Part in Workspace. Roblox’s standard Script runs on the server from Workspace; a LocalScript is the wrong choice for this setup. See Roblox’s guide to script types and locations.
Step 1: Create and configure the hazard Part
- Insert a basic Part from the Home or Model tools. In Explorer, rename it something recognizable, such as
KillPart.
- Move it to the hazard location. Use the Properties panel or Studio’s scale tools to set a size that players can clearly see and reach. For example, a wide, thin tile can cover an obby landing.
- Set Anchored to true so the trap stays in place. Keep CanTouch enabled; the touch event will not work if touch detection is disabled.
- Choose a color and material that communicate danger, such as red or orange. If the block should stop players, leave CanCollide enabled. If it is a hidden trigger volume, you can turn CanCollide off while keeping CanTouch on.
An anchored kill brick can still detect a moving character. Roblox notes that two anchored parts do not trigger Touched against each other, so test by moving a character across the part rather than by placing two stationary blocks together. The BasePart.Touched reference explains the event’s behavior and touch requirements.
Step 2: Add a server-side kill script
- In Explorer, right-click
KillPart, insert a Script, and confirm that the Script appears as a child of the Part.
- Open the Script, remove its starter code, and paste this version:
local Players = game:GetService("Players")
local trap = script.Parent
local hitCooldown = {}
trap.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass("Model")
if not character then
return
end
local player = Players:GetPlayerFromCharacter(character)
if not player then
return -- Remove this check if the trap should also kill NPCs.
end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if not humanoid or humanoid.Health <= 0 then
return
end
-- Keep Roblox spawn protection intact.
if character:FindFirstChildOfClass("ForceField") then
return
end
if hitCooldown[humanoid] then
return
end
hitCooldown[humanoid] = true
humanoid.Health = 0
task.delay(1, function()
hitCooldown[humanoid] = nil
end)
end)
Touched passes the specific body part or accessory that made contact, not the character model itself. The script therefore walks up to the containing Model, looks for a Humanoid, and uses Players:GetPlayerFromCharacter() to limit this version to players. The cooldown prevents multiple body parts from processing the same contact repeatedly.
The script checks for a ForceField before setting health to zero. Directly setting Humanoid.Health can bypass ForceField protection; the explicit check preserves spawn protection for this trap. For ordinary damage that should respect a ForceField, use humanoid:TakeDamage(25) in place of the health assignment. Roblox documents these health behaviors in its Humanoid reference and ForceField reference.
Step 3: Playtest the Kill Part
- Start a Studio playtest with the Play control and walk your character into the hazard.
- Confirm that the character is eliminated and respawns according to the place’s spawn settings.
- Stop the test, adjust the Part or script, and test again. Check the Output panel for script errors if nothing happens.
- If the experience is multiplayer, use Studio’s server-and-client testing options to confirm the result from a client session too. Roblox’s Studio testing modes guide describes the available test setups.
Test both the visible block and the character’s actual path through it. A trap can appear to overlap the floor while being positioned slightly above or below the route, so adjust its position if the character walks through without contact.
Useful variations
Make an invisible kill zone
Set Transparency to 1 and CanCollide to false, but leave CanTouch on. This creates a hidden trigger volume without making an invisible wall. Place it carefully and playtest from the player’s viewpoint so the zone feels fair.
Allow the trap to affect NPCs
The sample script intentionally ignores NPCs by returning when GetPlayerFromCharacter() finds no player. Remove that player check if NPC models with Humanoids should also trigger the trap. Keep the Humanoid and health checks so unrelated objects are ignored.
Use damage instead of an instant elimination
Replace humanoid.Health = 0 with humanoid:TakeDamage(25) to make the part a damaging hazard. Adjust the amount to fit your game, then test it with a player who has a ForceField so you can verify that spawn protection behaves as intended.
Kill Part troubleshooting
| What happens | What to check |
| The trap does nothing | Confirm the Script is under the Part, the object is a Script rather than a LocalScript, CanTouch is on, and the character physically touches the Part. |
| The Output panel shows an error | Check spelling, quotation marks, and that the code was pasted into the Script under the hazard. |
| Players pass through an invisible trap | For a trigger zone, CanCollide may be off, but CanTouch must stay on. Check that the zone spans the player’s route. |
| NPCs are unaffected | The sample is player-only. Remove the GetPlayerFromCharacter check if NPCs should be included. |
| Players survive the trap | They may have a ForceField. The sample intentionally leaves ForceField-protected characters unharmed. |
Frequently asked questions
Does the kill script go in Workspace or ServerScriptService?
For this beginner setup, put the Script directly inside the hazard Part in Workspace. Workspace is a server container for the default Script run context, and keeping the script with its Part makes the trap easy to move or duplicate.
Can I use a LocalScript for a kill brick?
Use a normal server-side Script for this example. The server should own gameplay outcomes such as changing a character’s health so the result is applied consistently to players in the experience.
Once the basic Kill Part in Roblox Studio works, duplicate it for additional hazards, give each a clear visual purpose, and playtest every placement before publishing.