I want to make my character's head face the camera, I tried
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local RootPart = Character:WaitForChild("HumanoidRootPart")
local UpperTorso = Character:WaitForChild("UpperTorso")
local Head = Character:WaitForChild("Head")
local Neck = Head:WaitForChild("Neck")
local Waist = UpperTorso:WaitForChild("Waist")
local Camera = workspace.CurrentCamera
local NFrame = Neck.C0
local WFrame = Waist.C0
game:GetService("RunService").RenderStepped:connect(function()
print(RootPart.Rotation.X)
Neck.C0 = NFrame * CFrame.Angles(
-math.acos(Camera.CFrame.lookVector.Y)*2/math.pi+ 1/2,
-((Head.Position - Camera.CFrame.p).unit:Cross(RootPart.CFrame.lookVector)).Y,
0
)
Waist.C0 = WFrame * CFrame.Angles(
-math.acos(Camera.CFrame.lookVector.Y)+ math.pi/2,
-(((UpperTorso.CFrame.p - Camera.CFrame.p).Unit):Cross(RootPart.CFrame.lookVector)).Y,
0
)
end)
and It did not work properly, my character's head faced 15 degrees down
