Enemy not doing damage to player

I have two different scripts for the player and the enemy. the enemy script is

var target : Transform; //the enemy's target
var moveSpeed = 3; //move speed
var rotationSpeed = 3; //speed of turning
var attackThreshold = 3; // distance within which to attack
var chaseThreshold = 10; // distance within which to start chasing
var giveUpThreshold = 20; // distance beyond which AI gives up
var attackRepeatTime = 1; // delay between attacks when within range

private var chasing = false;
private var attackTime = Time.time;

var myTransform : Transform; //current transform data of this enemy

function Awake()
{
    myTransform = transform; //cache transform data for easy access/preformance
}

function Start()
{
     target = GameObject.FindWithTag("Player").transform; //target the player
}

function Update () {

    // check distance to target every frame:
    var distance = (target.position - myTransform.position).magnitude;

    if (chasing) {

        //rotate to look at the player
        myTransform.rotation = Quaternion.Slerp(myTransform.rotation,
        Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed*Time.deltaTime);

        //move towards the player
        myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;

        // give up, if too far away from target:
        if (distance > giveUpThreshold) {
            chasing = false;
        }

        // attack, if close enough, and if time is OK:
        if (distance < attackThreshold && Time.time > attackTime) {
            // Attack! (call whatever attack function you like here)
            }
            attackTime = Time.time+ attackRepeatTime;
        }

      else {
        // not currently chasing.

        // start chasing if target comes close enough
        if (distance < chaseThreshold) {
            chasing = true;
        }
    }
}

and the player script is

var maximumhitPoints = 100;
var playerhitpoints= 100;
var isDead = false;

function ApplyDamage (damage:float) {
if (playerhitpoints < 0)
return;

//apply damage
playerhitpoints --;

if (playerhitpoints <= 0) {
Die();
}
}

function OnGUI() {
    if (isDead)
    {
        GUI.Box(Rect(10, 10, 150, 100), "You're dead");
        if(GUI.Button(Rect(5, 5, 15, 10), "Click here"))
        {
            isDead = false;
        }
    }
}

function Die()
{
    if(playerhitpoints <= 0)
        isDead=true;
}

when the player dies a pop up window pops up and says your dead and that works and the enemy follows you and all that but I can't get it to do any damage to me. I think the problem is where it says insert attack function here in the enemy script and I've tried doing an on collision function and a applydamage function but I keep getting the expect ( error. any ideas?

You don't want to do a collision function there. The code is set up to check for minimum distances already.

Just call the ApplyDamage function on the player where that attack comment is.

Here's one way to potentially do it (untested):

target.SendMessage( "ApplyDamage", 10 );