1 | Killer = script.Parent |
2 |
3 |
4 | Killer.Touched:Connect( function () |
5 |
6 | game.Players.FindFirstChild.Humanoid.Health = 0 |
7 | end ) |
First of all you'll need to gain access to the player's character in order to take their health away like so(I'll assume its a normal script):
1 | Killer = script.Parent |
2 | Killer.Touched:Connect( function (hit) -- hit will be whatever has touched the part (e.g left leg, etc) |
3 | if hit.Parent:FindFirstChild( "Humanoid" ) then -- we need to make sure it was a character |
4 | hit.Parent:FindFirstChild( "Humanoid" ).Health = hit.Parent:FindFirstChild( "Humanoid" ).Health - 100 -- Takes all their health. |
5 | end |
6 | end ) |
Any errors will likely be on your end, e.g not placing the script in the appropriate place.