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

How to get the force of a hit?

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

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.

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