Respawning script question.

I'm my scripts it wont let me access a character at all. For example my small respawning script i plan on building on. Could someone help? But I am looking for a solution to accessing the game object variables which i never have learned. please help me if you can.

 var mainCharacterHealth = 100;
    var dead = false;

    class health {
    var dead = false;

    function spawn ()
     //if you are dead goto position
     if (dead) {

     gameObject.transform.position = Vector3(0,8,0);

    function OnControllerColliderHit ( Hit : ControllerColliderHit )
     //if you hit the designated object you will take 99 damage
      {mainCharacterHealth -= 99;

hi! i am also looking something like you i tell you what i know

to access to the variable in a gameobject you can use the inspector-metod

var target : Transform;

using a script whit this declaration on top ,

select the object with the script
you can drag the “target-object” you want move …
on the inspector in the “target”,none transform ,
so you can talk-to him during the script , using the target.


if you want make the "link" during the game and not before start you must find it ....

var someone;    
    someone = GameObject.Find("player"); 

and then sure......


there are so many way to "find" the object ....