Health / Position reset

function Update () {
	}


var Health = 100;


function OnTriggerEnter(collision : Collider ) {
    Health+= -10;
    Destroy(collision.gameObject);
}

function OnGUI () {
		GUI.Box (Rect (1,1,200,30), "Health: " + Health);

}


if(Health = 0){
		
		transform.position.x = 0;
		transform.position.y = 1;
		transform.position.z = 0;
                  }

I think you can see what i am trying to do, When my health reaches “0” my position will be reset to the ‘Spawn’, only, it’s not working, i’m sure it’s a easy fix, Any help will be appreciated

EDIT:… Please HELP, i know it’s very simple!

Bump…

if(Health <= 0){
		transform.Translate(Vector3(0, 1, 0);
                  }

this should work, havn’t tested it.

Does not work, when i hit 0 it just does nothing

function Update () {
	}


var Health = 100;

function OnTriggerEnter(collision : Collider ) {
    Health += -10;
    Destroy(collision.gameObject);
}

function OnGUI () {
		GUI.Box (Rect (1,1,200,30), "Health: " + Health);

}


//--------------------------------------------------------------------------------

	
if(Health <= 0){
		transform.Translate(Vector3(0, 1, 0));
		}

i assume you have this code in a function like OnUpdate
right?

i have the code set up exactly like i pasted in the above post, also put it in a function update() { } but nothign

ah okay…
this:

if(Health <= 0){
		transform.Translate(Vector3(0, 1, 0));
		}

needs to be moved to your Update()

should look like this then:

function Update () {

if(Health <= 0){
		transform.Translate(Vector3(0, 1, 0));
		}
	}

Wow, it works, sort of lol, when i hit the last one it Keeps sending me up, Could i use

transform.position.x = 0
transform.posititon.y = 1
transform.posititon.z = 0 ?

EDIT, It works, but i am then stuck at that place, not being able to move?

add this line

Health = 100;

here:

function Update () {

if(Health <= 0){
		transform.Translate(Vector3(0, 1, 0));
                Health = 100;

		}
	}

Fantastic!, Thanks alot