I'm trying to make a vehicle damage system, but when the vehicle scrapes wall it deals constant damage, how can I stop this?

local impactVelocity = parent.Velocity.Magnitude local hitVelocity = hit.Velocity.Magnitude

if impactVelocity >= 40 or hitVelocity >= 40 then

if impactVelocity >= 40 then

	hp = hp - impactVelocity + 35

else

	hp = hp - hitVelocity + 10

end

end

1 comment

0

You could make it so that when it detects the vehicle touches something, it deals a certain amount of damage depending on the velocity of the vehicle, and then waits until it stops touching that object.