- Home /
 
               Question by 
               NinjaRubberBand · Dec 02, 2013 at 05:56 PM · 
                systemrespawn  
              
 
              My respawn system does not work
I made this script so when i collide with a object, i get teleportet back to my spawn point. But it does not work, what is wrong with the script?
  #pragma strict
     
     function OnCollisionEnter(collision : Collision) {
     
       if (collision.gameObject.tag == "Wall")
       
       transform.position.x = -0.08707774;
       transform.position.y = -3.114533;
       
       }
               Comment
              
 
               
              Answer by meat5000 · Dec 02, 2013 at 05:57 PM
Is the Wall Tagged "Wall" or just named?
Both objects have rigidbodies and colliders?
Also, your if statement is missing braces.
 if (collision.gameObject.tag == "Wall")
  {
       transform.position.x = -0.08707774;
       transform.position.y = -3.114533;
  }
They have colliders, but not rigidbody. I tried attaching a rigidbody but it still does not work. ANd actually the scene is made, so rigidbody would ruin it.
Your answer
 
 
             Follow this Question
Related Questions
AI Path and respawn help!!! 0 Answers
Falling off respawn script 1 Answer
Character selection system help script 2 Answers
Particle System, change the velocity by script 1 Answer
Looking for RPG system (look inside) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                