I’ve made a health script and I’m not sure what’s wrong, help? The error is in line 24.
var curHealth : int = 3;
var maxHealth : int = 3;
var healthtext : GUIText;
var Damage : int = 1;
function Update () {
if(curHealth <=0){
Application.LoadLevel(Application.loadedLevel);
}
healthtext.text = curHealth + " / " + maxHealth;
if(curHealth < 0 ) {
curHealth = 0;
}
if(curHealth > 3) {
curHealth = 3;
}
}
function OnTriggerEnter(hit:Collider){
if(hit.tag == "Enemy"){
curHealth - Damage();
}
}