Sidescroller turret Script

Hi i'm currently trying to make a sidescrolling platformer but i'm having some problems with a turret script, i know what i want it to do and so on but i cant seem to get it into code.

I want a very simple script, i just want it to look at the player when it's within a certain range and fire a bullet every -- seconds.

Some help to were i can find some help or some suggestion how to do it here would make me very happy.

Something like this should do the job. Create this Javascript script, and place it on your turret object. This should actually work fine for both 2D and 3D gameplay. Make sure your turret object is modeled so that its barrel is pointing along its forward axis.

The turret object will need a trigger collider (probably best to have a sphere collider), which acts as the range within which the turret will fire.

The player needs to be tagged "Player"

You also need to create and assign a bullet prefab, which must have a rigidbody component. This is so the turret can instantiate bullet objects as required.

The script works by starting a Coroutine if the player enters the trigger area. The Coroutine loops, keeping the turret pointed at the player, and fires a bullet every second. The loop ends if the player exits the zone (because target is set to 'null' if that happens).

Enjoy!

var bulletPrefab : Rigidbody;
var bulletSpeed : float = 10;
private var target : Transform;

function OnTriggerEnter(otherCollider : Collider) {
    if (otherCollider.CompareTag("Player"))
    {
        target = otherCollider.transform;
        Fire();
    }
}

function OnTriggerExit(otherCollider : Collider) {
    if (otherCollider.CompareTag("Player"))
    {
        target = null;
        StopCoroutine();  // aborts the currently running Fire() coroutine
    }
}

function Fire()
{
    while (target != null)
    {
        var nextFire = Time.time + 1;
        while (Time.time < nextFire)
        {
            transform.LookAt(target);
            yield WaitForEndOfFrame();
        }

        // fire!
        var bullet = Instantiate(bulletPrefab, transform.position, transform.rotation);
        bullet.velocity = transform.forward * bulletSpeed;
    }
}

I tried this script on my turret but i am getting an error

Assets/Turret Script.js(20,22): BCE0017: The best overload for the method ‘UnityEngine.MonoBehaviour.StopCoroutine(String)’ is not compatible with the argument list '()

how do i fix it?