I am trying to make a game kinda like SCP 3008. And I wanna make a custom AI that checks if the player is within the AI’s field of view. I have seen a post about how to check if an object is within the field of view but that only works with a given position and I need it to work for all players.
Basic said: How would I make a script for an AI that checks if a player is within its Field of View.
I cannot include any script since I have no idea how to do this.
You may want to try raycasting from the ai’s head to every player’s humanoidrootpart, so that way if there’s something blocking them then the ai will only target player’s that were seen
You can try to just detect the player’s humanoidrootpart position relative to the position of your ai’s head with cframes then once you have the players that are in front of the ai, raycast to check if there’s any obstructions