I have a truck that I tweened in location, and I want to make sure that the players that were on the truck stay on the truck.
When the truck tween starts, obviously the player falls off and stays in the same spot.
I have tried welding seats to the truck but that doesn’t help, how do i make sure that i tween the players standing on the truck together with the truck?
Also tween the players? You would have to wait until the truck has started the tweening and tween the players at the same pace
How would I tween the players? Using HumanoidRootPart?
Most likely, as HumanoidRootPart
is the root of the plr
How would I define HumanoidRootPart? I tried the following:
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local HumanoidRootPart = player.HumanoidRootPart
but it always resulted into a nil value… What am I doing wrong?
You could try welding the player to the part. You could also use CFrame as well. This might help. Of course you would need to do your casual tweenservice.
Alright I’ll take a look, I’ll tell you later if it worked
You could try and create a system that duplicates the player, and bind it to the truck using model. Then have the tween bind to the model, so it isn’t just client side. Or use bodygryo i would think.
To Get The HumanoidRootPart Do It Like This
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local HumanoidRootPart = char.HumanoidRootPart
You add the trucks velocity to the players Velocity. So if the truck is moving the player will move as well.
So if the truck is moving at a rate of (0,0,30).
Player.Velocity = Player.Velocity + Truck.Velocity
The reason we add it onto the players current velocity is so that the player can walk around the truck. If we were to just set the players velocity to the trucks velocity the player would be unable to move once in a truck.
Thank you! this really helped!