Killed When touched

I’m making this game where when you touch the water you die. How would I script it so when its touched it sets there heath to zero.

BasePart | Documentation - Roblox Creator Hub.

1 Like

You can look at ROBLOX’s Touched Event and incorporate that inside your script.

script.Parent.Touched:Connect(function(hit)
   if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
      hit.Parent:BreakJoints()
   end
end)
1 Like

I Will try this first to see if it will work of if it works right with the game

If you want the player to die immediately, then his script is the right thing you are looking for.

Sorry, I made a mistake in my script. I have corrected it above.

Okay thats what i was looking for but ill still test both out

1 Like

Thank you it worked I will Put it in my game and credit You for the Help

1 Like

Hey im now having a problem heres the thing: 19:43:02.133 - BreakJoints is not a valid member of Humanoid “Workspace.epicrobloxmaster22.Humanoid”

Never Mind Problem solved i had it disable to get past what i was doing