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

How do i make a kill player script?

how do make a kill player script?

2 comments

0

script.Parent:Destroy() wait(5) game.Workspace.Union:Destroy()

0

^ what?

1 answer

You can use the Humanoid to access the health of the player, and then change that to zero. This is just an example event firing the function, and it could run in any type of way.

--scripts parent is a brick 
script.Parent.Touched:Connect(function(hit) --when brick is touched connect a function and give it the argument hit, which is whatever touched it.
if hit.Parent:FindFirstChild("Humanoid")then --if hit contains a humanoid (like a character of the player) then
		hit.Parent.Humanoid.Health = 0  --set the health of that humanoid to 0, killing them
	end  
end)

https://developer.roblox.com/api-reference/class/Humanoid

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