I wrote a script that is supposed to work like health but I keep getting an error. Can someone tell me what’s wrong? Here’s the script:
var health = 5;
function OnCollisionEnter(collision : Collision)
{
if(collision.gameObject.tag == “enemy”)
{
health -= 1;
}
}
function Update () {
if(health = 0){
transform.position = Vector3(8.973378, 1.511276, 1.136956)
}
}