Platformer Make Enemy face Player only in Vision range

Hi can you take a look at this please Move enemy back and forth while player is not in vision