Yeah, im pretty sure thats just roblox physics being jank. Not a scripting problem at all.
Fortunately, roblox are actually working on something which you can view here.
From the post:
Now with that out of the way, to avoid a potential other post, this is a beta feature, publishing a game using it will result in your game not working properly.
This is currently only usable in studio (i think)
There are ways to script you way around this, but i dont think its worth scripting a fix when this is coming out sometime in the future.
In the post they’re talking about how the new beta humanoid controller has support for keeping momentum when jumping.
Moving with a moving vehicle you are standing on already works with the current humanoid system.
The player doesn’t stay on your train because the train has no velocity, its simply having its position changed every frame. You will not get any physical reactions if you do this.
You’d want to drive the trains motion via constraints, either by diretly applying VectorForce/LinearVelocity, or actually spinning the wheels with HingeConstraints, or some other simulated system.
Or, you’d need to write code for the player (and anything else you want to have interactions with the train) to also update it’s CFrame with the train’s
VectorForce applies a constant force LinearVelocity applies a dynamic force, to speed up or slown down an object to the given velocity (with a max of course)
But I don’t think you should use constraints to move the train since then it becomes possible to derail the train.