(UnityScript)Trying to spawn a clone of a prefab every few seconds

Ok. So Basically, I have a sword sprite that I want to appear once every 2-5 seconds if a variable is true, then disappear after a second. I put this in a function called attack. The problem is,if I try to put attack(); into the update function, it spawns a ton of them! I need only one to spawn at a time! My code:

function attack() {
if (isHit == true) {
Destroy(GameObject.Find(“sword”));
WaitForSeconds(Random.Range(2,5));
Instantiate(sword,transform.position, Quaternion.identity);
WaitForSeconds(2);
Destroy(GameObject.Find(“sword”));
}
}

How do I run this every 2-5 seconds with only one appearing at a time?

function Start() {
StartCoroutine(“attackCoroutine”);
}

function AttackCoroutine() {
	var destroyed : GameObject = GameObject.Find("sword");
	if (destroyed!=null) Destroy(destroyed);
	WaitForSeconds(Random.Range(2f,5f));
	if (isHit == true) StartCoroutine("attack");
	StartCoroutine("AttackCoroutine");
}

function attack() {
	Instantiate(sword,transform.position, Quaternion.identity);
	WaitForSeconds(2f);
	var destroyed : GameObject = GameObject.Find("sword");
	if (destroyed!=null) Destroy(destroyed);
}