Train lagging causing separation of train cars?

What do you mean by programmatic weld? I weld each carriage together. I cannot think of anyway of moving the train car into the right position based on relative position of another model you said. Also what do you mean by updating it frequently? Mind sharing your code with me of what you mean?

1 Like

Try to see if you can get that function executing more frequently.

Another thing you can do is create a new place and add the relevant models/scripts. Make sure they work as much as they can and invite me and/or others via Team Create. Will take a look when I have a moment.

1 Like

I am firing it rapidly. Sure I will upload the place as private and then I will invite you in team create.

@blazepinnaker I am adding you as a friend right now. And please accept it so you are in team create.

1 Like

Alright @blazepinnaker, I now invited you in team create. Check your shared with me in studio now!

Hey @blazepinnaker! Are you doing the fix in team create? When are we doing team create? We should text via discord, send me your name and tag

Just handle the train physics on the client. The server should never have to handle any intense calculations like this.

1 Like

@Kurookku I don’t use physics to move the train and its train cars. I use a modulescript and parented to serverscriptservice. Which means its running on server, causing jiterry and separaring train cars because of lag. I move them with tweenservice and the main train car is also used with tweenservice

That’s not what i’m saying. Even if you are using tween service the server still has to replicate the moving parts to all the users in the game. With network latency and the servers very very very small allocated bandwidth, you need to have the client handle the movement of the trains, not the server.

1 Like

How would I do it on the client? Yes i would use :FireAllClients() But which line of the TrainSuperClass module script I would put the remoteevent:FireAllClients(). Which line? Plus where I would put the remote event? In ReplicatedStorage? Also where i should parent a localscript that is going to pick up the fired remote event?

for example:

RemoteEvent.OnClientEvent:Connect(function()

end

Put a remote event in replicated storage, when ever you spawn a train just fire the event to all of the clients and then create the train on the client. moving the train wherever you chose for it to go.

1 Like

So I have to create to remote events. SpawnTrain and TrainClientReplication. Thats the names of the remotes i am creating.

As ive asked before, Where do i parent a local script to pick up the fired event?

You only need one remote event. That remote event would basically have the server send the train info to the client, the client then would create a train with the given info and do all the tweeting. The client script would go in StarterScripts > PlayerScripts

1 Like

Alright 1/2 solved. The localscript will be parented in StarterPlayerScripts. so would pickup the remoteevent with all the parameters. Also which line of the module script I would put :FireAllClients() as ive showned the full train mechanics code above.

You can object orientate your code but you can’t figure out where to put a remote event request?

1 Like

I dont know which line of code i should put it in? As I have shown you the train mechanics code above.

The reason i kept asking those questions because I wanted to know how did Jailbreak do trains

I don’t really know how much I can help you. I can’t hold your hand through the entire process, sometimes you just gotta try things and see if it works.

1 Like

@Kurookku You are doing your best to help me anyway. Thanks though, I appreciate it. I will use what you suggested above and I will try and see if it works. I will tell you if it works!

Alright dude good luck with it!!!

1 Like

Alright @Kurookku after a few days, I tried everything. It did reduce some lag and it smoothen the carriages little bit somehow but they are still separating.