- Home /
 
 
               Question by 
               Extremis1 · Jun 12, 2017 at 09:09 AM · 
                javascriptcollisionvector3charactercontrollerdestroy  
              
 
              Respawn when a character hits an object with a tag of "Kill" , but after 3 deaths the controller is destroyed
I have tried to create some sort of death counter that counts the number of deaths and respawns the player after each death. After 3 deaths, the controller is meant to be destroyed, but i can never get this to work. Here is the teleporting script used so far:
 function Update() { }
 
     function OnControllerColliderHit(hit) {
         {
             if (hit.gameObject.tag == "Kill") {
     
                 transform.position = Vector3(0, 20, -36);
     
             }
         }
     }
 
               this works, but when i try to incorporate a death counter, everything mucks up. Can someone please help me?
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
OnCollisionStay for seconds then destroy 0 Answers
Destroy a GameObject 2 Answers
CharacterController Gravity 2 Answers
Collision Detection in Capsule Collider 0 Answers
Pick-Up Object With Mouse Hold 0 Answers