Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to make a player killing part?

Give me instruction or script how to do it?

1 comment

0

pretty sure the toolbox has like 9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 models of these lmao. in fact theres one i made in my inventory if you wanna check that out, it expands too

4 answers

✓ Accepted answer

Hello! So, making a kill part is very simple. Simply, create a LOCAL script inside the part. Inside the LocalScript, insert this code:

local part = script.Parent --defines part

part.Touched:Connect(function(hit) --gets function
	local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid") --finds humanoid
	
	if humanoid then --checks that humanoid was found
		humanoid:TakeDamage(100) --kills humanoid, also killing the player
	end --ends if statement
end) --ends function

What it does is it gets the part, detects when it gets hit, then gets the humanoid. If it finds the humanoid, it kills the humanoid, causing the player to get killed as well.

Hope this helps!

You have to insert a part with a script into the workspace, and use this to check when the something has touched the part. You can easily find one on the internet, just search around a little before going onto here.

local Part=workspace["PARTNAMEHERE"]

Part.Touched:Connect(function(Player)
if Player:IsA("BasePart") and Player.Parent:IsA("Model") and Player.Parent:FindFirstChildWhichIsA("Humanoid") then
Player.Parent:BreakJoints()
end
end)

Simply just change "PARTNAMEHERE" in the script to the name of your part or if you put the script inside the part change

local Part=workspace["PARTNAMEHERE"]

to

local Part=script.Parent

1 comment

0

This is an out-dated way.

Hi! First, insert a Script inside the part that are gonna kill the player. This is the script:

local KillPart = script.Parent

KillPart.Touched:Connect(function(hit) 
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent:WaitForChild("Humanoid").Health = 0
	end
end)

It's a very simple script. It works perfectly for me. Let me know if that script also worked for you!

This discussion is preserved as it was. New answers, comments, and votes are closed.