So I’m working on a game and it has a properly operating currency system. I am trying to make a trigger destroy when the player enters with a certain amount of coins. I have made a static var called currentScore and when the player reaches 2 coins I want the field to destroy so that the player can pass through and its not working
script:
#pragma strict
function OnTriggerEnter(other : Collider) {
if (currentScore == "2") {
Destroy.gameObject;
}
}
The script is bound to the trigger. Any help would be greatly appreciated considering I’m a noob.
Cheers