Mini Gun Turret

I’m making a turret that right now just rotates around constantly. I want this to happen but also when my “Player” gets within a good range I want the Mini Gun Turret to look at my player and shoot at it. Thanks in Advance

I think this is what you want to use:
Transform.LookAt. Have the turret part “look” at the player when it comes into range using that function.