Hi, so I have my train which works, but it looks weird when its moving. It has a pause in between the nodes and it doesn't go very smooth.
Video: https://streamable.com/1wbhua
My Code:
local RunService = game:GetService("RunService") local node = 0 function movemodel(model,start,End,AddBy) for i = 0, 0.5, 0.01 do if not model.PrimaryPart then break end model:SetPrimaryPartCFrame(model.PrimaryPart.CFrame:lerp(start.CFrame, i)) RunService.Heartbeat:Wait() end end while true do local nextnode = game.Workspace.Nodes:FindFirstChild(node + 1) local End = game.Workspace.Nodes:FindFirstChild(node + 2) node = node + 1 movemodel(script.Parent,nextnode,End) end
What happens when you take out the Wait?
Try removing this line:
RunService.Heartbeat:Wait()
But in removing the wait, it probably will go too fast...
To get smooth motion, at a reasonable speed, I think the use of align constraints and physics may be the way to go, instead of cframing..... I saw an example on the dev forum that I'll try to find for you, today.