Stop unanchored player model from rotating when player hasnt moved

As you can see from the video above the actualCharacter part is rotating very slightly from the tween of the part being squished. Is there any way to stop this from happening or to allow my script to have a little less leniency towards the rotation? as right now my script needs the angle of the player to be perfect every time.

local player = game.Players.LocalPlayer.Character:WaitForChild("actualCharacter")

--this is the part of my code that needs the orientation to be perfect every time
if player.Orientation.Y == -180 then
	player.Orientation = Vector3.new(0, 0, 0)
end

If player.Orientation.Y >179.9 or player.Orientation.Y < -179.9 then

Another reason is that 180.0000000001 and -179.999999999 can be a result of Floating Point Error in computer base 10 number calculations.

When using numbers it causes errors when you are using a line like if x == 3 being false if it’s 3.000001.

1 Like