03-07-2020, 11:00 AM
BTW, the way you are calculating speed is wrong, you have to use pythagoras to get the value instead of just x + z.
The function can be used like this:
I am developing an anticheat that uses onplayermoving so i had to go through this process too.
The function can be used like this:
Code:
function OnPlayerMove(aPlayer, OldPosition, NewPosition)
Displacement = math.sqrt(((NewPosition.x-OldPosition.x)*(NewPosition.x-OldPosition.x))+((NewPosition.z-OldPosition.z)*(NewPosition.z-OldPosition.z)))
end