How to orient the player to the camera orientation?

  1. What do you want to achieve?
    How to orient the player to the camera orientation ? :thinking:
  2. What is the issue?
    The character does not orient to the camera orientation ! :slightly_smiling_face:
  3. What solutions have you tried so far?
    I’ve searched a while and I have found anything that reply to my problem … :neutral_face:
1 Like

Try this code, put it in local script

wait(3)
local player = game.Players.LocalPlayer
print(player.Name)
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Attach 
1 Like

Thank you for the reply ! :grin:
But that’s not what I want, I want to know how can I rotate the player when my camera rotate ! :smiley:
Sorry for my bad english … :neutral_face:

Did you mean something like this?

wait(3)
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local rootPart = player.Character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera

camera.Changed:Connect(function()
	local cameraDirection = camera.CFrame.Rotation
	local rotX,rotY,rotZ = cameraDirection:ToEulerAnglesYXZ()
	local rootPartPos = rootPart.CFrame.Position
	local RootRotX,RootRotY,RootRotZ = rootPart.CFrame:ToEulerAnglesYXZ()
	print(cameraDirection)
	rootPart.CFrame = CFrame.new(rootPartPos)*CFrame.Angles(RootRotX,rotY,RootRotZ)
	
	
end)
2 Likes

Thank you so much that totally what I want ! :grin:
Have a nice day ! :yum:

No problem! Can you set it as solution so new people will see what was the key?
Ugh, i didn’t see that is set as solution, my bad!
Have a nice day too! :slight_smile:

2 Likes