Car won't return to the original position

So I’m trying to have cars that go around in loops and so far the script was working fine until I noticed when it comes back it’s like 2 studs away from the position it started.

while true do
 wait()
 	for i = 1,32 do
 	script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,-4)	
 	wait()
end

for i = 1,10 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,-3)
 wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(9),0) * CFrame.new(0,0,4)	
 wait()
end

for i = 1,100 do
 script.Parent.CFrame = script.Parent.CFrame + Vector3.new(-4,0,0)	
 wait()
end

for i = 1,10 do
 script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(18),0) * CFrame.new(0,-1,0) 
 wait()
end

for i = 1,100 do
 script.Parent.CFrame = script.Parent.CFrame + Vector3.new(4,0,0)
 wait()
end

for i = 1,10 do
script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,3)
 wait()
script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(-9),0) * CFrame.new(0,0,4)	
 wait()
end

 wait()
 	for i = 1,32 do
 	script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,4)	
 	wait()
end

for i = 1,10 do
 script.Parent.CFrame = script.Parent.CFrame * CFrame.Angles(0,math.rad(-18),0) * CFrame.new(0,1,0) 
 wait()
end

end

If it’s 2 studs away then shouldn’t you move the frame 2 studs back to where it should be? :thinking:

You’re not going in a perfect circle (obviously). My solution to this problem would be to have a point, and rotate the car around that point. For example:

local offset = CFrame.new(20, 0, 0)
local point = script.Parent.CFrame * offset

for i = 1, 100 do
    wait()
    script.Parent.CFrame = point * CFrame.Angles(0, math.rad(180 * i / 100), 0) * offset:inverse()
end

rather than trying to dial in angles and offsets manually.

If you’re not going around in a perfect circle then you could use this method to make turns and such. I made this in a textbox so the math may be off.