I have tried making a train and the train is being moved by tweening. I have a problem however, and that is that the Player wont stay on the train. I have tried many solutions from DevForums but it wont work due to how my train game works
Im at a lost. its been 2 days
Any help is appreciated
You can use this code to give the part a velocity so that it moves the player with it:
lastpos = part.Position
game:GetService("RunService").Stepped:Connect(function(_, deltatime)
local currentpos = part.Position
local deltapos = currentpos - lastpos
local velocity = deltapos / deltatime
part.AssemblyLinearVelocity = velocity
lastpos = currentpos
end)
this gives it a velocity so that the player moves on top of it. It doesn’t work too well with high speeds but I guess it could be good enough. It does have a small amount of delay with the movement of the player though.