Programming error

When ever i right click on a enemy my player goes up to the enemy and attacks once i wnat my player to attack constantly can anybody point out why my player would stop attacking and help me fix my script.

here is my Enemy AI script where my player targets the Enemy

using UnityEngine;

using System.Collections;

public class EnemyAI : MonoBehaviour {

public Transform target;

public int moveSpeed;

public int rotationSpeed;

public int maxDistance;



private Transform myTransform;



void Awake() {

	myTransform = transform;

}

// Use this for initialization

void Start () {

	GameObject go = GameObject.FindGameObjectWithTag("Player");

	

	target = go.transform;

	

	maxDistance = 2;

rotationSpeed = 5;

	moveSpeed = 3;

}



// Update is called once per frame

void Update () {

	Debug.DrawLine(target.position, myTransform.position, Color.yellow);

	

	//Look at target

	myTransform.rotation = Quaternion.Slerp(myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);

	

	if(Vector3.Distance(target.position,  myTransform.position) > maxDistance) {

	//Move towards target

	myTransform.position += myTransform.forward * moveSpeed * Time.deltaTime;



}

}

}

and heres y attacking script this lets my player attack and stuff

using UnityEngine;

using System.Collections;

public class EnemyAttack : MonoBehaviour {

public GameObject target;

public float attackTimer;

public float coolDown;

	

// Use this for initialization

void Start () {

	attackTimer = 0;

	coolDown = 2.0f;

}



// Update is called once per frame

void Update () {

	

	if(attackTimer > 0)

		attackTimer -= Time.deltaTime;

	

	if(attackTimer <0)

		attackTimer = 0;

	

		if(attackTimer == 0) {

		Attack();

			attackTimer = coolDown;

	}



}





private void Attack() {

	float distance = Vector3.Distance(target.transform.position, transform.position);

	

	Vector3 dir = (target.transform.position - transform.position).normalized;

	

	float direction = Vector3.Dot(dir, transform.forward);

	

	if(distance < 2.5f) {

		if(direction > 0) {

	EnemyHealth eh = (EnemyHealth)target.GetComponent("EnemyHealth");

	eh.AdjustCurrentHealth(-10);

			}

	}

}

}

please help me and alter the approprite script an tell me whats going on Thanks in Advance

you have no yield statements to pause, so long as the distance between one character to another is less than 2.5 the enemy health will continuously reduce.