I would like to make a train that moves backwards and forwards forever. I use the script below but the train just stays still. What have I done wrong and how can I fix it?
local Model = script.Parent
while wait() do
for i = 0,1,.001 do
Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.new(0,0,-i))
wait()
Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * CFrame.new(0,0,i))
wait()
end
end

6 comments
Look at lines 5 and 7. Look at the i and -i
try printing the primary parts cframe to see if it does move, but only a little to the point where its barely noticeable
I really suggest you use bodyforce, velocity, gyro etc. to make the best user experience.
Use TweenService. I use it for my crate drops
what's a moving train that doesn't move?
It's meant to move but doesn't