How to check if player no longer can see pawn(AI)

So how can i do something like this?