A small tutorial, about trains with cframe

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

  1. 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.

  2. insert script anywhere in your model, you can add functions that begins procedure.

  3. 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
8 Likes

If this is for beginners it may be helpful to provide a video of the process or the end result

Otherwise this seems like a pretty good tut

1 Like

Oh, i forgot that, here is a video

1 Like

i cannot understand how to make it because not enough info about how it must be made

1 Like

To make it controllable you more or less just have to hand over the tweening capabilities to the user right so that should be feasible to develop on top of this

1 Like