Help: Trying to make a roblox dummy's head move and face the player without its body moving with it (r6)

so basically im trying to script something for a horror game where the dummy “NPC” is just standing and its head is facing the player from whichever angel the player is from and I want it to be client sided to each player, I’ve managed to write this but for some reason the head rotates to the wrong axis

here’s the script:

local neck = workspace.SkinWalker.Torso.Neck
local NPC = workspace.SkinWalker

function getClosestPlayer()
local closest_player, closest_distance = nil, 30
for i, player in pairs(workspace:GetChildren()) do
if player:FindFirstChild(“Humanoid”) and player ~= NPC then
local distance = (NPC.PrimaryPart.Position - player.PrimaryPart.Position).Magnitude
if distance < closest_distance then
closest_player = player
closest_distance = distance
end
end
end
return closest_player
end

local cframe0 = neck.C0
while true do
local player = getClosestPlayer()
if player then
local is_in_front = NPC.PrimaryPart.CFrame:ToObjectSpace(player.PrimaryPart.CFrame).X < 0
if is_in_front then
local unit = -(NPC.PrimaryPart.CFrame.p - player.PrimaryPart.Position).unit
neck.C0 = cframe0 * CFrame.new(Vector3.new(0, 0, 0), unit)
end
end
wait()
end

Im trying to make the head move left to right or right to left