LineVelocity doesn't work correctly

Hey there. I’m currently working on a train game and for the train chassis system I used LineVelocity.
The problem?
When I test the game in studio it work correctly:


While in Roblox Player it doesn’t (In this clip I removed the two carriages because I thought them were the problem):

Does anyone know how to fix this? I’ve been working on this for a while now, so I don’t want to throw it all away…

Thanks!

Hi there

Normally, behavior in Roblox Studio and the live game can differ because of how the Client Server model works. In Studio (Play Solo), your computer acts as both the client and the server, so physics and communication feel instant.

Online, however, the server (hosted by Roblox) handles most of the simulation, and sometimes delegates physics control to a client. If you’re using LinearVelocity / BodyVelocity and it works in Studio but not in the live game, the most likely cause is Network Ownership, not latency or internet speed.

When a client becomes the network owner of a part, that client is responsible for simulating its physics. If a server script tries to apply a velocity while a client owns the physics, the effect might be delayed, ignored, or inconsistent, because the simulation is happening locally on that client.

1 Like

Hey! Yeah, I perfectly know that don’t worry! The problem is that I don’t know how to solve it…

you need to force the server to be the permanent owner of the train’s physics. BUT, there is a catch that most people miss: if you call the function and then weld a new part to the train, you have just created a new assembly. When this happens, Roblox resets the Network Ownership to “Auto”, and your script breaks. The same thing happens if you anchor and then unanchor a part.

The fix is to do it in the right order: Finish building the entire train (weld all parts, add all constraints) first, and then call SetNetworkOwner(nil) on the PrimaryPart as the very last step.

Also, make sure you are using the modern LinearVelocity with Attachments, not the old BodyVelocity. It handles the network model much better.

Thanks I’m gonna try! Don’t worry, I’m using the recent LineVelocity, not BodyVelocity.