Details I want to know how to use Ray cast and implement that to detect if the npc is infront of the Player. I do not want it to detect players through walls , only in the range of the NPC.
this is very simple use find part on ray
in script
local npc = script.Parent while wait(1) do local ray= Ray.new(npc.HumanoidRootPart.Position, npc.HumanoidRootPart.CFrame.lookVector) if FindPartOnRay(ray).Parent.Humanoid then -- ur code end end