I may be reading this wrong but if you are only trying to fiind which way the NPC is facing at the player just cast a ray in each direction from the torso and if it hits a player then we know they hit the NPC is facing the player from that direction
You could probably just find the vector between the target and the NPC and then find the dot product between the lookvector and the vector to the target and compare that to the dot product between the right vector and the target vector, etc. and compare which dot product is the greatest.
The more ‘parallel’ the vectors are, the bigger the dot product is.