Hi, i’ve searching a lot on youtube and dev forum in the past, and i can’t find any good, simple tutorial how to make simple non drivable train that follows path, today i wan’t to make tutorial for beginners, if you are advanced scripter, this tutorial is maybe not for you , if you have not any problems with tween service or cframes and physics. Let’s start
-
make your model of train , or minecart, with small part facing front of model under it, this part could be on the same height as your rails to prevent cart fly.
-
insert script anywhere in your model, you can add functions that begins procedure.
-
scripting:
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(0.3,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut)
for i = 1, #workspace.Points:GetChildren() do
local tween = TweenService:Create(script.Parent,Info,{CFrame = workspace.Points:GetChildren()[i].CFrame}) -- i put script in part that touching rails
tween:Play()
tween.Completed:Wait()
end