Solutions on DevHub resulted of topic’s that weren’t what I was looking for, etc: Check if you can see someone’s head using workspace:WorldToScreenPoint, but it always activates no matter what side, but, I need to detect if a player’s head is looking at a specific side of a NPC’s head.
If you want to determine if a vector is going towards a point, you can compare that vector to a vector of the same origin but pointing directly towards it and choose a range for which they can differ in degrees. Then do this twice, to compare from both perspectives. But it’s completely up to you to define what “looking at” means.
So the quickest way to do this is via the dot product.
local dot = npc.Head.CFrame.LookVector:Dot(character.Head.CFrame.LookVector)
if (dot > 0.5) then
-- looking at each other
else
-- not looking at each other
end
You can check out the article I linked for the explanation as to why this works.
I’d also rcmd adding a distance magnitude check to this as well to ensure the npc and your character are within a reasonable distance. That’s of course completely up to you.