Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I want to teleport a player to a position, but the player is facing the wrong way?

Asked by 3 years ago

I want to teleport the player to a position (106.668, 1.388, 9.372), but the player is always facing the wrong way. How do I teleport a player to that position whilst also having the player rotate 90 degrees? It is also important to note that the player will be locked in the first person. I have tried the following:

character:SetPrimaryPartCFrame(CFrame.Angles(0, math.rad(-90), 0) * character:GetPrimaryPartCFrame())
rootPart.CFrame = CFrame.new(106.668, 1.388, 9.372)

1 answer

Log in to vote
0
Answered by 3 years ago

When setting CFrame you need to set its position as a Vector3 value, in addition, the second argument of CFrame is the orientation

ex.

Part.CFrame = CFrame.new(Vector3.new(1,1,1), Vector3.new(5,5,5))

That will move the part to the position, (1,1,1) and the part will be looking at (5,5,5)

Ad

Answer this question