How do I make players stay on moving models?

So, I want to make players stay on a moving model like a car because I need it for my game.

My problem is that the player wont stick on the moving model, the model just goes without the player and
I dont know how to fix that, if I should do it with a script or with something diffrent.

I looked everywhere on youtube, this forum and other websites but I could not find any tutorials on that so I decided to ask here for help. I also have seats on the car but I want the players to be able to stick on the car too when they dont sit.

I already tried to do a script that pushes the player forward in the car but that didnt work

does anybody have any ideas to help me with a script or something diffrent? You dont have to give me entire scripts I just need some tips. Thanks for the help.

1 Like

Weld a seat to it. I have a pickup truck in a game that I welded seats in the back of that look like tool boxes and wood crates. Worked like a charm. Custom animate yours so it doesn’t look like they’re sitting.

1 Like

There’s another post relating to your problem: Jailbreak train platform system?

1 Like

If you’re moving the car with tweens or changing its CFrame manually, then that means you’re not setting the car’s Velocity. The car is moving, but it’s not moving, so the passengers don’t move either, you get what I’m saying?

You see the opposite of this when you set the Velocity of a completely still and anchored part: it becomes a conveyer belt. If this part were also being moved/tweened in the direction of its Velocity, then you’d have a part that moves and also moves whatever is standing on it.

Velocity is the rate of change of the Position.
If you tween a brick with Linear from (0, 0, 0) to (10, 0, 0) in 2 seconds, then the Velocity of the part should be (0, 0, 0) before and after the tween (when it’s completely still) and (5, 0, 0) during the tween, because it’s moving at 5 studs per second for 2 seconds, which amounts to 10 studs of movement.
If you tween it with Quad the same way, then the Velocity should be tweened with Linear from (0, 0, 0) to (10, 0, 0).
If you tween the car with Cubic, then the Velocity should be tweened with Quad from (0, 0, 0) to (15, 0, 0).

Example
-- Put this inside an anchored Part at the center of the world
-- and an unanchored part on top of it, or just stand on it
local TweenService = game:GetService("TweenService")
local part = script.Parent
local duration = 2
local distance = 10

-- y = x^3
-- x^3 is cubic
-- easingdirection is In because that starts out slow and ends up fast
local tween1 = TweenService:Create(
	part,
	TweenInfo.new(duration, Enum.EasingStyle.Cubic, Enum.EasingDirection.In),
	{Position = Vector3.new(distance, 0, 0)}
)
-- y' = 3*x^2
-- x^2 is quad
local tween2 = TweenService:Create(
	part,
	TweenInfo.new(duration, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
	{Velocity = Vector3.new(distance * 3 / duration, 0, 0)}
)

function start()
	part.Position = Vector3.new()
	part.Velocity = Vector3.new()
	tween1:Play()
	tween2:Play()
end
tween1.Completed:Connect(start)
start()

Learn about differentiation if you want to know why, or simply set the velocity to (position B - position A) * time since the velocity was last changed really often.

If your car is unanchored and actually physically simulated and players aren’t staying on it, then the car’s part might have 0 Friction.

If all else fails, make the world move around the car instead of making the car move. This way, the players still stay still, but so does the car.

2 Likes