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

help with Torso Velocity's magnitude which is killing player?

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)

1 answer

✓ Accepted answer

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

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