Undet_Dev
(Undet_Dev)
#1
Hello, I have a quite small problem that I do not know how to fix;
Player.Character.HumanoidRootPart.Position = CFrame.new(CCar.PrimaryPart.Position + 0, 5, 0)
In this line of code, I try to teleport the player’s character to the cloned car primarypart position, but I do not know how to make it work.
The error is this one:
[21:46:06.179 - ServerScriptService.DealerShipEvent:12: bad argument #2 (Vector3 expected, got number)]
I already tried using Vector3 instead .Position, but it tells that Vector3 is not a valid member of VehicleSeat. Any suggestion?
sjr04
(uep)
#2
You can’t add a vector3 by a number, only multiply or divide. You seemed to want to add a Vector3 so do + Vector3.new(0, 5, 0)
Undet_Dev
(Undet_Dev)
#3
If I put
Player.Character.HumanoidRootPart.Position = CFrame.new(CCar.PrimaryPart + 0, 5, 0)
I get this error;
21:51:55.833 - ServerScriptService.DealerShipEvent:12: attempt to perform arithmetic (add) on userdata and number
sjr04
(uep)
#4
You need to add the position…
Player.Character:SetPrimaryPartCFrame( CFrame.new(CCar.PrimaryPart.Position + Vector3.new(0, 5, 0)) )
1 Like
Adding on to @incapaxx’s solution:
instead of doing this:
Player.Character:SetPrimaryPartCFrame( CFrame.new(CCar.PrimaryPart.Position + Vector3.new(0, 5, 0)) )
you can shorten it by doing this:
Player.Character:SetPrimaryPartCFrame(CCar.PrimaryPart.CFrame)
because now it will rotate the player if the car is rotated also, because you don’t want the player to sit sideways.