Pathfinding to avoid pathing in a player’s field of vision

Shapecasts might be the solution for you.

https://devforum.roblox.com/t/introducing-shapecasts/2320655