I figured out how to make an NPC's head turn towards another object, but it looks weird when the target object moves behind the NPC and the head goes into impossible positions and it looks creepy. How can I find the angles of where the head is facing so I can manipulate those angles into rotational restrictions?
local bg = script.Parent:WaitForChild("BodyGyro")
local head = script.Parent
while wait(0.5) do -- loop the movement
-- maybe do some type of check before proceeeding and facing towards the target???
bg.CFrame = CFrame.new(head.Position, Vector3.new(workspace.Lobby["Police Chief"].Head.Position.x, head.Position.y, workspace.Lobby["Police Chief"].Head.Position.z)) -- pretty much just makes the head look towards a police chief's (head).
end
Very simple script here, speaks for itself

5 comments
Not completely, but I see how I can fix it, I'll accept as soon as I figure it out, thx!
sorry, i meant "if the NPC faces the x direction" not policeman
and u may wanna substract the head's position from the target instead of the other way arnound to get the lookvector X) Anyway correct by the lookvector of the rest of the body if it's not just always facing x (like in my example)
Hahahaha fantastic! I figured it out! I used the .unit for my answer, thank you for the help very much!!
awesome!