Question by 
               BankShotZombies · Nov 23, 2017 at 12:34 AM · 
                javascriptmovementdestroytime.deltatime  
              
 
              I need help with this script. Can't figure out my it isn't working.,Can't get this script to work
I am simply trying to make a cube go from one place to another and then be destroyed. I am new to JavaScript. Thank you for your help. Here is the script:
 function Start () {
 
 }
 
 
 function Update () {
     Square ();
 }
 
 function Square () {
     var ZAxisStop : boolean = true;
 
     while (ZAxisStop)
     {
         gameObject.transform.Translate(0, 0, Time.deltaTime * -2.5);
         if(gameObject.GetComponent(Transform).position == Vector3(229, 0.5, 227))
         Destroy (gameObject);
         break;
 }
 }
 
Thank you :),I am trying to make a cube simply go from one place to another and be destroyed using JavaScript. When I run it, it is never destroyed, it just keeps going. Please help me. This is my script:
 function Start () {
 
 }
 
 
 function Update () {
     Square ();
 }
 
 function Square () {
     var ZAxisStop : boolean = true;
 
     while (ZAxisStop)
     {
         gameObject.transform.Translate(0, 0, Time.deltaTime * -2.5);
         if(gameObject.GetComponent(Transform).position == Vector3(229, 0.5, 227))
         Destroy (gameObject);
         break;
 }
 }
 
Thank you:)
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                