I’m trying to make an automatic train but I’m having trouble with it. Right now I got my train to go on a linear path but is there a way to allow the train to turn freely when on tracks?
Here is the script that I have now:
workspace["Metro11"].PrimaryPart = script.Parent.Engine
while true do
for i = 1,100 do
wait()
workspace["Metro11"]:SetPrimaryPartCFrame(CFrame.new(workspace["Metro11"].PrimaryPart.Position + Vector3.new(0,0,-1)))
end
end
You’re gonna have to mess with those numbers a bit though, but make sure to use math.rad(Number) for each number when you do it, as it gives you an accurate degree
I tried it and the train won’t move now. Is this the correct way to use it?
workspace["DC Metro11"].PrimaryPart = script.Parent.Engine
while true do
for i = 1,100 do
wait()
workspace["DC Metro11"]:SetPrimaryPartCFrame((CFrame.new(workspace["Metro11"].PrimaryPart.Position + Vector3.new(0,0,-5)) * CFrame.fromEulerAnglesXYZ(math.rad(45), 0, 0)))
end
end