Head and torso follows camera but not in first-person (R6)

So, I’ve been trying to fix this issue with “Head and torso follows camera but not in first-person”, but it’s just so hard since there are not many questions similar to mine.

The script:

repeat wait() until script.Parent

local char = script.Parent

local mouse = game.Players.LocalPlayer:GetMouse()

game["Run Service"].RenderStepped:Connect(function()

local rightshoulder = char.Torso["Right Shoulder"]

local rightshoulderpos = CFrame.new(1, 0.5, 0) * CFrame.Angles(-math.asin((char["Right Arm"].CFrame.Position - workspace.CurrentCamera.CFrame.Position).Unit.Y), 1.55, 0)

local leftshoulder = char.Torso["Left Shoulder"]

local leftshoulderpos = CFrame.new(-1, 0.5, 0) * CFrame.Angles(-math.asin((char["Left Arm"].CFrame.Position - workspace.CurrentCamera.CFrame.Position).Unit.Y), -1.55, 0)

local neck = char.Torso.Neck

local neckpos = CFrame.new(0, 1, 0) * CFrame.Angles(-math.asin((char.Head.CFrame.Position - workspace.CurrentCamera.CFrame.Position).Unit.Y) + 1.55, 3.15, 0)

rightshoulder.C0 = rightshoulderpos

leftshoulder.C0 = leftshoulderpos

neck.C0 = neckpos

end)

Where the script is placed:
placed

How it performs:

Any help would be appreciated!

1 Like

Lol, sorry for having a bad hand-writing. Hope you can read the text in the video.

I fixed it myself lol. Here:

--Client
repeat wait() until game:GetService("Players").LocalPlayer.Character
local events = game:GetService("ReplicatedStorage"):WaitForChild("Events")
local cam = workspace.CurrentCamera
local humRootPart = game:GetService("Players").LocalPlayer.Character:WaitForChild("HumanoidRootPart")

game:GetService("RunService").RenderStepped:Connect(function()
	events:WaitForChild("MoveBody"):FireServer(math.asin(cam.CFrame.LookVector.y))
end)
--Server
local events = game:GetService("ReplicatedStorage"):WaitForChild("Events")
local neckC0 = CFrame.new(0, 0.8, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)
local waistC0 = CFrame.new(0, 0.2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1)

events:WaitForChild("MoveBody").OnServerEvent:Connect(function(plr, theta, cam)
	local neck = plr.Character:WaitForChild("Head"):FindFirstChild("Neck")
	local waist = plr.Character:WaitForChild("UpperTorso"):FindFirstChild("Waist")
	neck.C0 = neckC0 * CFrame.fromEulerAnglesYXZ(theta * 0.5, 0, 0)
	waist.C0 = waistC0 * CFrame.fromEulerAnglesYXZ(theta * 0.5, 0, 0)
end)

3 Likes