How to make snap to angle rotation?

local roundingAngle = 45 obj.rotation = math.floor((obj.rotation%360+roundingAngle/2)/roundingAngle)\*roundingAngle

Or you could do that…

thanks for all the help guys! It’s as simple as a rounding function, can’t believe I didn’t think of that.