random generator location

I made a generator of enemies, I wanted to make sure that every 2 seconds changed position random the problem is that it continues to change it because it is in the update function. How can I fix?

/*

 generatore instanzia ogni 4 secondi uno zombie, ogni 2 secondi cambia posizione sull'asse X o Y
 
 oggettoDaInstanziare, RandomX, RandomY,Tempo


*/


  var zombie : GameObject;
  var tempoDown : float = 2.0;
  var time : float = 0.0;

function Start () {

StartCoroutine(Creation(4)); //Coroutine

}

function Update () {




     
     if(time > tempoDown){
     
     
       var sposta : Vector3 = Vector3 (Random.Range(9.0,28.0),0,0);
       
       transform.position = sposta;
       
       time = 0;
       
     
     
     }
     
     
     
     
     else{
     
     time += Time.deltaTime;
     
     
     
     
     
     }

}


function Creation(tempo){

while(true){ //finchè è vero esegui il ciclo
   
   	//var posizione : Vector3 = Vector3 (Random.Range(-1.9,1.9),2.5,2);
      //var pallaNuova : int =  Random.Range(0,instanza.length-1);
      Instantiate (zombie, transform.position, transform.rotation); //instanza chrismasBall
     
     
      
     //instanza.AddComponent(Rigidbody); //aggiungo rigidbody alle instanze
     
      /*
      instanza.transform.position.x = Random.Range(2,-2); //raggio di instanza
      instanza.transform.position.y = 2; 
      instanza.transform.position.z = 0.2; //distanza dalla Main Camera
      instanza.transform.Translate(0, Time.deltaTime, 0); 
      */
      yield WaitForSeconds(tempo);
   
   
 
  

}





}

I settled in to change the values ​​in the script mnon remembered that I had to change the interface. Thanks anyway :slight_smile: