Need Help/Advice on Creating a Script for My Train to Move (similar to jailbreaks train)

Greetings Developers!

As this is my first post, please do bear with me if i “overexplain” things or am an annoyance lol.

I want to make a train that runs in my game, similar to jailbreaks train; with a spawn point, despawn point, follows the tracks, and can randomize cars and the layouts. I also want to randomize the number of locomotives and the directions they face (obviously the leading loco will always face forward).

I have a list of all the train cars here, and also I have the image of the two locomotive spawns.

Basically what I want to know is what to write for my game to get this to run (or what to start writing). I understand this is kinda tricky writing about everything because you don’t have access to my game, but nonetheless, I’m trying. I can also include info below on the number of parts in each train car, and also the percentage of some train cars spawning.


Screenshot 2023-01-23 201522

GondolaEmptyRed - 50% chance of spawning
HeavyDutyFlatcarEmptyRed & HeavyDutyFlatcarEmptyYellow - 5% chance of spawning
TankCarBlue & TankCarMintGreen & TankCarSilver - 2% chance of spawning
TrashFlat - 10% chance of spawning

(All other cars and locomotives don’t have a lesser chance of spawning, I guess that means they have a 100% chance of spawning… I guess?)

The wheels for the locomotives will be called “trucks” and the wheels for the cars will be called “bogies”. I didn’t name them that but that’s just what id want them to be called. And I can assign “truck1” and “truck2” for each locomotive since both have different wheel types.

Both “wheels” (which I’m just saying for the sake of time. It’s the full wheelset, including frames) have multiple parts. However, they aren’t anything important, just different parts and different colors. I want them to move equally. Don’t know if I just need to group them or what.

Bogie - 9 parts
Truck1 (ES44ACE) - 26 parts
Truck2 (SD70ACE) - 3 parts

Each locomotive and train car has 2 sets of their wheels, so double the number of parts for each.

I would like a range of train cars of 15 to 65, and a range of locomotives from 2 to 4. And, the longer the train, the more locomotives, proportionately, if possible.

Idk what I need to do to keep the train cars together, as I have multiple pieces to each train car. You can ask me more about this if need be.

I do know that the trains in jailbreak use cframe, and I have looked at other posts similar to what I need on the dev forum, but they don’t necessarily work because they don’t have the same requirements as I do, so I waited till I was able to make a post.

I would like to note that I don’t have a lot of scripting experience. I am a modeler and I have no one to script, so I’m slowly learning on my own. Any help would be much appreciated!

If you need more info or have questions, let me know and I will help to the best of my ability. Thanks in advance!

Sincerely,
Duke

Take a look at this video.

Thanks, ill take a look at this!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.