I need help with my code to make a “lose 1 health” and the when they die they have a screen come up, and then you have to go to home.
var Losehealth = pc.createScript('losehealth');
Losehealth.attributes.add('st1 health',{type : "entity"});
Losehealth.attributes.add('nd2 health',{type : "entity"});
Losehealth.attributes.add('rd3 health',{type : "entity"});
Losehealth.attributes.add('death',{type : "entity"});
Losehealth.attributes.add('touch',{type : "entity"});
let Lost = 0;
{
if((Touch == true)) {
Lost += 1;
}
if (Lost == 1) {
this.St1health.enabled = false;
}
if (Lost == 2) {
this.Nd2health.enabled = false;
}
if (Lost == 3) {
this.Rd3health.enabled = false;
this.Death.enabled = true;
}
}
I just need a script that can disable the health entity and then when the health runs out, your game stops, than you have a death screen.