Enemy ai follow player only when spoted

I created enemy ai where he roams around the area freely but now i want him to follow the player when he is near to player. i already know how to make ai follow player but i want him do follow only when within the radius , i removed the follow script because he follows the player all over the area . like he already know where iam magically but now i dont want it . all i want him to follow only when i move closer to him and while not being spoted i want him to roam around area which i already created . here is the link which i used to make ai roam around area “A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums