✓ Accepted answer
#What you could do?
When you change the CFrame of an object you change its Position as well as its Rotation. You need to change the rotation at the same time as you change the position. A tip is when you're doing a while loop you can put a wait instead of true so that after every wait it will loop. You can also write down workspace by itself instead of game.Workspace.
#Angles
In CFrame you get a 3D position and rotation. When you just set the position the rotation is 0 by default.
part.Rotation = Vector3.new(0,102,2)
part.CFrame = CFrame.new(0,10)
There is a simple way to set the Angle's rotation:
CFrame.Angles!
This Constructor will return a rotation that you can combine with the CFrame to get a position AND rotation.
part.CFrame = CFrame.new(0,2,0)*CFrame.Angles(math.pi,0,0)
#Final Product
I'll record the original rotation via variable and apply it later.
while wait() do
for _,v in pairs(workspace.Train:GetChildren()) do
local rot = v.Rotation
local x,y,z = rot.X,rot.Y,rot.Z
v.CFrame = CFrame.new(v.CFrame.X + -.3, v.CFrame.Y, v.CFrame.Z)*CFrame.Angles(math.rad(x),math.rad(y),math.rad(z))
end
end
Hope it helps!