Proximity enemies

Im looking to make something like a proximity turret that if the player gets close enough the will turn to face the player following the players movements and shoot at them what would be the best way to go about this.