Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to get the force of a hit?

Asked by
lucas4114 607 Moderation Voter
8 years ago

I've tryed adding the x y z of the velocity but it doesn't work. What could I do to get a force of a hit?..

script.Parent.Touched:connect(function(Part)
    local force1 = script.Parent.Velocity.X + script.Parent.Velocity.Y + script.Parent.Velocity.Z
    local force2 = Part.Velocity.X + Part.Velocity.Y + Part.Velocity.Z
    local TotalForce = force1 + force2
    print("Damage was "..TotalForce..".")
    script.Parent.Damage.Value = script.Parent.Damage.Value + TotalForce
end)

1 answer

Log in to vote
0
Answered by 8 years ago

I believe there is no true force or energy in roblox, but there is p and Maxforce. For instance if this was a bullet or shell script you could define the part in the function, then check the part's children and find Bodyvelocity or other types of velocity. Then look at Maxforce and p to get what you need.

Ad

Answer this question