Detecting any humanoids in NPC Sight

basically, im trying to find a way to detect if any humanoits is in NPC’s sight.

i’ve already implemented the Dot Product and Range system just not detecting if that humanoid thats getting detected is blocked by an obstacle or not.

im currently thinking of using raycast from npc position to the humanoid position to detect if theres an obstacle, if no then it will return the humanoid, if yes then no humanoids.

is there another way than raycasting? just wanna know

Hello, if you will try using raycast. I suggest you to check this script

Sorry for bad english

its from the npc itself and not the player, so using current camera is not possible

Its local script? 3000000000000

Try to understand what im trying to achieve on the original message, all the detections are from servers

I mean npc probably can’t see through walls. but if you meant npc fov, check this script.

Ye you can check it on server

raycasting will be the most efficient solution here no real reason to avoid it