No errors, just need help to prevent player's death if player's velocity is 0
script.Parent.Touched:connect(function(p) local hum = p.Parent:FindFirstChild('Humanoid') if (hum ~= nil) and p.Parent.Torso.Velocity.magnitude > 0 then hum.Health = 0 elseif hum ~= nil and p.Parent.Torso.Velocity.magnitude < 0 then print('Safe') end end)
So your code is well, but its one issue. A character's Torso never has the velocity of 0 in any of its values. Due to roblox animations, or animations in general, the torso it constantly moving in some direction. Try changing the value from 0 to like .2 or .3