I have a part m1.Top that orbits around part orange. This works fine, the only problem is that instead of maintaining the rotation it had before the orbit starts, it resets the rotation of m1.Top.
How can I fix this problem?
Code:
for i = 1,180 do wait() m1.Top.CFrame = CFrame.new(orange.Position) * CFrame.Angles(0, math.rad(i*2), 0) * CFrame.new(0, 0, (orange.Position - m1.Top.Position).magnitude) end
I did it.
local x,y,z=m1.Top.CFrame:toEulerAnglesXYZ() for i = 1,180 do wait() m1.Top.CFrame = CFrame.new(orange.Position) * CFrame.Angles(0, math.rad(i*2), 0) * CFrame.new(0, 0, (orange.Position - m1.Top.Position).magnitude) * CFrame.Angles(x,y,z) end