Hi, I have created a lifebar which decreases in increments when a Healthfield is entered and a trigger is activated by the Player. It works well but I cannot understand how to load a new scene when 3 negative increments have been reached. Can anyone help on this? Here is my current code for the Healthfield…
var Hurtbox: boolean = false;
function OnTriggerEnter(other: Collider){
if(other.gameObject.tag == ("Player")){
if(Hurtbox && LifeBar.Health >= 0){
LifeBar.Health--;
}
else if(!Hurtbox && LifeBar.Health<=2){
LifeBar.Health++;
}
//Destroy(gameObject);
}
}