[Duplicate]How to Repeating command in js

I am trying to instantiate a zombie object every 1 seconds. but it only does it once how can I make it repeat continuously?

CODE:
#pragma strict

var z : GameObject;

yield WaitForSeconds (1);
Instantiate (z);

function Start () {

}

function Update () {
}

Hi there,
What you need to do is use the “InvokeRepeating” method.
it goes like this:

function Start(){
InvokeRepeating(functionName,time Before repeating starts, how often to repeat);
}
function functionName(){
//spawn zombie code here
}

I hope it helped :smiley: