Hello there
I’m Woodx, and I’ve made alots of tutorials, and if you like my tutorials, please donate by paypal or by robux,anyways lets begin the tutorial
If you have read my other basic train tutorial: How to make a basic train
It actually de-rails, like an original train, its based on Roblox physics, but many of the developers messaged me saying, how they can make a animated train, in simple
In this tutorial, you will learn how to make a moving roller coaster/ train
In the video, you actually see, the roller coaster moves, at a speed, to the track, however, you can also add carts like
- 3 carts roller coaster
- 4 carts roller coaster
- 10 carts roller coaster
However, I cannot tell you surely, 10 carts moving will be good performance, if your looking for something like in Theme park tycoon, its probably 10 moving LPM (Low Poly Meshes), its like 10 parts moving, so it would be great, but for some developer like me, who makes every thing inside roblox, you have to go for fewer carts
Step 1: Making tracks and track folder
First add a folder, in workspace
Name it anything you wish, I will name it “TrackFolder” to make the tutorial simple and easy to understand
Add a part to it, which is your track, you can name it “1” or just don’t rename it, its good if your re-naming, because, the roller coaster will move from 1- (your number of tracks), but if you don’t name it, it just takes the order of parts
I will tell you how to make a moving coaster from both the methods of track
- Name like 1,2,3,4,5
- Order of tracks
Now, make your track, you can either use a union( a single part) or a mesh, for the sake of difficulty, don’t go for models, it will make the word, hard but its still possible
Step 2: Making tracks
Make one track, any track, it does not matter, I made this simple ,uh some kinda track
Ez
Uh, now name it thats all, if you don’t wanna name them, skip this part
Step 3: Making tracks to form a huge map
Get this plugin to make it easier to make tracks
Make your track, and then name it
1,2,3,4
I know its hard, if you don’t want to do this, then you should clone your tracks in order, like you have to
clone a track, and make sure its below the first track, this will make it easier
Step 4: Making the roller coaster
Now, to avoid train going sideways, like train going left or right, or in simple words, in the wrong way
Make sure your track and coaster are of same sides
Like, let me explain
Add a surface selection, and set the adornee to the track, and see which side of the track is front side
Backside of the track, is front
As you see the backside of track is front
Like that, find what is your side of the track, now make sure the same side of the roller coaster base is also like that, I will show what it means in this image
Like if backside of the track is front for the train, then make sure your roller coaster backside also faces front
In this image, the blue highlighted, is backside, and as you see both backsides of track and roller coaster are same, hope you understood, read this section again, if you did not understand, its simple trust me
Step 5: Making script
If your a new scripter, or you find scripting hard, you shouldn’t have to worry, this is a 10 line script max, yes it is 10 line max
Also if you used track number system, you should do this:
local ts = game:GetService("TweenService")
for i = 1,8 do -- a fininite loop, in maths, we call it summation, or sigma notation
local info = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0) -- info, you can edit, this but, you should also edit the wait function below to make train move correctly
local goals = {
CFrame = game.Workspace.TrackFolder:FindFirstChild(i).CFrame + game.Workspace.TrackFolder:FindFirstChild(i).CFrame.UpVector*2
}
local part = script.Parent -- the part which is going to tween
local anim = ts:Create(part,info,goals)
anim:Play() -- this will play the animation, tween animation, it will tween the train
task.wait(0.3) -- waits 0.3, not 0.5 because, after 0.2 the train will stop, so before the train stops, we make it move, to avoid random speed, like slow then fast,then slow, then fast
end
If your going for order of tracks, go for this:
for i,v in pairs(game.Workspace.TrackFolder:GetChildren()) do
local info = TweenInfo.new(0.5,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)
local goals = {
CFrame = v.CFrame + v.CFrame.UpVector*2
}
local part = script.Parent
local anim = ts:Create(part,info,goals)
anim:Play()
task.wait(0.3)
end
You can see the script and read it carefully, you can actually see how it works if you understood it
Test it, I see it moving, sorry but my recorder broke, and I’m unable to show the video, but you can actually notice, your train moves, but if your train/roller coaster is moving to random tracks, it means your track is wrongly re-named, or wrong order, so you should go for number system if wrongly ordered tracks, and if your train is going to random tracks, then you should check if you named your track correctly
Note: this is how you actually do it
You don’t have to name, your first track, like the starting of track anything, because, the train, won’t go to it, unless, you make a loop, like a track going to start
Also, you can also make a physics thing, like if your roller coaster is going upwards, it goes slow, however its too hard for normal devs, (I also don’t know how to do it clearly to tell it lol)
Step 6 Done
Now, you need to weld your roller coaster, parts to the train, to make one good looking train, but make sure the parts welded to the train/roller coaster are unanchored, only the train part should be anchored
Thats it, tutorial is done, enjoy, please donate if you wanna thank me, it took me 2 hours to write this tutorial