I would do that but lerp will not work for me since i am using a custom interpolation function for the curves which will not work with that.
I now am telling the client which part of the rail the train is on, and then the client runs the interpolation on its own copy of the train. This solution has worked for me, but i have now run into 2 more problems.
The client runs the interpolation every RenderStepped, but when it has completed on that section of rail, it has to wait until the server changes the RailLocation of the train, which is a value i have made to tell the train what seciton of track it is on. The server doesnât know how fast the RenderStepped is going, and it may be different for every client, if im correct. Is this the wrong way to go about it?
Now also the player still canât interact with the train, even though its cframe is being changed on the clientâs side. Should i weld all the trainâs parts to the PrimaryPart, and then just set the CFrame of the PrimaryPart of the train?
The only problem left is to do with physical interactions with the trains. The player canât stand on the train when it moved, which is the only real physical interaction that i am worried about. Is there any way to allow the player to still interact with the train even though i am using CFrame to move it?
Youâd have to do some math in regards to that. Iâm not to sure what the math will look like but You have to declare your players position relative to the position of car. and increase player cframe based on the train cframe and any input movement u decide to incorporate.
If you want to have real-time physics interaction without having to write your own physics interaction/collision code, I would just use BodyMovers instead of individually CFraming.
You could also update the Velocity property of any part of the train you want players to stand on, just figure out how fast itâs going each frame and update it.