How would I go about making a tram system?

How would I go about making a tram system similar to the one in Pinewood Computer Core? (similar in terms of functions)?

I honestly have no clue about how to do this. I would assume VectorForce or something. Can anyone point me in the right direction? Thanks.

I believe this is the wrong subcategory (should go to #help-and-feedback:game-design-support)

Anyways, can you explain what a tram system is? I have no clue.

A tram is like a mini train line which usually connects points A <-> B in a continuous loop, stopping at the station on either side for about a minute and then departing. My problem is that I don’t know how to script it so it matches the description. Would I just use CFrame?

You could use CFrame, but if it’s a vehicle that can be driven, it should have a NetworkOwner.

You’ll need to do some scripting and you’re going to need to make some tracks for it. I’m not sure how to make a track system so… I’m just guessing. I assume just find the next part (think of the part as a waypoint) and use something like AlignPosition to position it to the next one.

1 Like

I’ve never found a single perfect solution for a multi-passenger vehicle. There are various approaches, each with limitations.

You can anchor the vehicle and move its CFrame continuously. If you do this, you either need to apply a linear/angular velocity to the part where the characters are standing so that they move at the same pace as the vehicle, or you need to move the characters manually. If you move the vehicle on the server side, all clients will get a consistent view but you will generate network traffic every time you move it, and the network traffic budget is pretty small in Roblox before lag becomes a problem. You can avoid this by moving the vehicle in each of the clients (which works when the part is anchored since the server automatically has network ownership so the clients won’t send updates). The downside is that the server sees the vehicle as standing still, so server-side physics may not work as expected.

Alternatively, you can pick a single rider of the vehicle and give them network ownership. That client will get the smoothest view of the animation. If you connect the vehicle to an anchored part with an AlignPosition and move that anchored part via CFrame (in a client script from the client with network ownership), then physics will work for the most part, and riders will move along with the vehicle. If you want them not to drift around at all, though, other hacks will likely be required, like temporarily welding them to the vehicle when they’re not trying to move around. The vehicle can attach to the track with other constraints (e.g., PrismaticConstraint), but my experience is that each track segment needs to be fairly short for this to work properly (~50 studs). You can use ray casting to find the next track segment and re-attach as you go along.