Help with NPC neck

I am literally dead inside lol. I’ve been trying to get my NPC’s head to look towards the player characters head but its just not working. I have a animation playing for the NPC if that has anything to do with it, though the animation does not effect the head. Please help if you can. It seems to work but the head of the NPC is screwed up.

code;

local NPC = script.Parent
local neck = NPC.Torso.Neck

function GetClosestPlayer()
	local closestPlayer, closestDistance = nil, 100
	for index, player in ipairs(game:GetService("Players"):GetPlayers()) do
		local character = player.Character
		if (character and character:FindFirstChild("Humanoid")) then
			local distance = (NPC.HumanoidRootPart.Position - character.HumanoidRootPart.Position).magnitude
			if (distance <= closestDistance) then
				closestPlayer = player
				closestDistance = distance
			end
		end
	end
	return closestPlayer
end
local cframe0 = neck.C0
while true do
	local player = GetClosestPlayer()
	if (player) then
		local character = player.Character
		if (character) then
			local isInFront = NPC.Head.CFrame:ToObjectSpace(character.Head.CFrame).Z < 0
			if (isInFront) then
				local unit = -(NPC.Head.CFrame.p - character.Head.Position).unit
				neck.C0 = cframe0 * CFrame.new(Vector3.new(0, 0, 0), unit) * CFrame.Angles(0, -math.rad(NPC.Head.Orientation.Y), 0)
			end
		end
	end
	wait()
end

cant you do CFrame:lookAt()? I think you should try that out.

I did, doesent work. Since its moving CFrame it makes the entire NPC’s body look at you. I just want the head using Neck.

Uhm, I dont think so. Did you really try out Head.CFrame:LookAt()? Or did you try character.PrimaryPart.CFrame:LookAt()

Head.CFrame = CFrame.lookAt(Head.CFrame, head.Position)

like I said Ive done it doesent work.