Basically Notoriety. Check out that game btw. When NPC look at you that detect you, but if you behind a wall, they don't detect players.
I tried making a hat for the NPCs that will touch a player if he/she is in the NPCs sight. But it goes through walls so that doesn't work.
Please help me. I have no idea what to do, iv been thinking about this for more than a year.
you can use camera.GetPartsObscuringTarget()
more here
You can raycast from the NPC's head to the target, if it hits a body part belonging to them, then the NPC sees them.
local maximumDistance = 300 -- the ray's max distance, in studs local ray = Ray.new(NPC.Head.Position, (TARGET.HumanoidRootPart.Position - NPC.Head.Position).Unit * maximumDistance) local hit = workspace:FindPartOnRayWithIgnoreList(ray,{NPC}) if hit.Parent == target.Parent then print("i can see the player") else print("i cannot see the player") end
Keep in mind that I haven't tested the code above, so it may need some tweaking.