I am new to coding and I am trying to make my player take damage when an AI touches it, this is my code so far:
var maxHealth = 100;
public static var currentHealth = 100;
var PlayerHealthDisplay : GUIText;
function Start() {
DisplayAmount();
}
function DisplayAmount () {
PlayerHealthDisplay.text = ""+ currentHealth;
}
function OOnTriggerEnter(collider:Collider) {
if (collider.tag == "beep"){
currentHealth += -10;
PlayerHealthDisplay.text = ""+ currentHealth;
}
}
The player does not take any damage though, how should I change it?