How to make a basic train?

So, I’m trying to make a very basic train, 4 wheels, a base and a vehicle seat. However, every single tutorial I have found about this specific topic either doesn’t work or is severely outdated, (dating back to 2015). Roblox Studio has changed alot, including the hinges that people use in those tutorials.

What I want:
A simple train that can only move forwards and backwards using a vehicle sea
The track:
image
t.

3 Likes

There are a few ways.
If you just need a straight line then try this setup using a PrismaticConstraint | Roblox Creator Documentation
<PlatformModel - Roblox

If you do want it to go around corners then try this one:
Train Experiment.rbxl (39.8 KB) (just change the VectorForce in the red Carriage Parts to get it to move forward and backward.

Or just use the VehicleSeat | Roblox Creator Documentation Throttle Property then script wheels with HingeConstraint | Roblox Creator Documentation s in them (set to Motor, with a Torque value in them) to turn when the W or S keys are used in the seat.

5 Likes

I’ve tried the Hinge Constraint, however. It is quite buggy.

(It gets stuck and then suddently goes the other direction)

Strange.
How are you setting up the HingeConstraint so it “gets stuck and goes the other direction”?
Do you mean the hinged wheels start rotating the opposite direction, or the train gets to one end, stops, and then returns?

Make sure the Hinges set to ‘Motor’ on wheels are rotating correctly since if they are on the opposite side of the train (left and rignt) then the ones on one side will need a + RotationalVelocity and the ones on the opposite side will need a - RotationalVelocity.

The train experiment place I included has each of the 2 rail cars on 4 wheels, with the HingeConstaints set to None, and the moving force is from the VectorForce X or Z Force (I can’t remember at the moment). I’ve had that model up to crazy speeds and as you can see the track segment are angled at 10 or 15 degrees so it is definitely not a straight track. When the Force is set way up around 40,000 it starts to jump the track after a while.

1 Like

Yeah that was the issue, I fixed it now. Also, there’s another issue. Turns, it is terrible at turning. I’ve tried making the track larger on one side, and then it works however when the track needs to become smaller again it derails. I have no idea how to make it properly turn.

Make sure your tracks are the same distance apart at all times and that the turns are smooth.
Did you have a good look at the sample place I gave you? The rails there are only 1 stud wide, but I have a lot of support around them with the car wheels, centering wheel, and sliders underneath the rails to keep them from coming off the tracks. Like I said, it’ll go crazy fast before it falls off. The centering wheels are also at the same location as the wheel axles above them so the wheels are always sitting centered on each rail.
If you have to make the rails look narrower then you can put a BlockMesh in each one and decrease the scale of the BlockMesh to make them appear narrower.
Another issue is the Density of the train Parts you are using. The more dense they are the more inertia each car has and that inertia can cause the train to push off the track. Make most of your car parts have the Massless Property turned on (true). Keep the Parts that are contacting (in my model, the wheels, centering wheels, sliders and Seats) at standard Density properties. If I was going to add anything else to each car I’d make those Massless true.

I have these “barricades” at each side of the rail to prevent it from derailing.

image

I have kinda made a solution to this problem which can be found below:
image

it’s however quite janky and annoying to constantly build.

Example:
https://gyazo.com/512c33f14d7d433673cb309b2398b7a3

You still haven’t answered if you have

like in my train sample.

I do not, it seems to be quite unrealistic.

Most train games have some form of “gliders” to keep the train on track, they are invisible obviously.

Ummm, the gliders in my example work perfectly until you reach insane speeds and as @BuiIdTheBuilder said they aren’t visible if you make them Transparent.

Nobody can help you if you don’t at least try their suggestions.