Can anyone help me with a script to fire when the Player comes within range?
Use a trigger volume. Set up a spherical trigger collider around your enemy (by adding a sphere collider, then checking "Is Trigger". Then use OnTriggerEnter handler in your enemy's script to call your enemy's Fire function.
If you haven't yet made a Fire function at all, you should probably either Instantiate a projectile prefab, and set its rotation and velocity using the player's forward direction, or cast a ray in the player's forward direction and apply damage to whatever it hits.