Why does my game lag so much

I want to make my game not lag

it lags a lot when the train crashes into another train making it so you can barely drive and it makes the gravity slow and unrealistic is there any way to fix this?

Network ownership + physics lag. Have you tried setting network ownership? This should fix the lag, but it probably won’t fix the gravity thing.

Also that game looks pretty cool, not gonna lie

4 Likes

to compliment what @robloxcommunityplus is saying, have you considered trying to make the trains rendered locally with a system in place to ensure each client train is in sync (or at-least in sync enough) That way their individual clients can handle the physics of the collisions. The only issue with a system like this is you’d probably be needing to change a significant amount of things. However, I believe it is best common practice to leave visuals to the client. (Also anyone is free to correct me if I’m misspoken)

2 Likes

who should i set network ownership to should i make all of the trains parts to the player who clicks the spawn train button?

It more depends on the situation - I’m pretty sure that once the player leaves, the train would switch back to auto, which would cause the train to lag again. This would probably put less stress on the server though.

2 Likes

I set the network owner to the person who press the button it lags the player and train moves slow

If you set the network owner to the person, that means that the person’s computer is doing all the heavy lifting of physics.

i dont know how to do it make me lag