Hello, I am looking for advice for a points system. I have tried a couple things but they aren’t working very well at all. First of all I am trying to create a planet system, when you hit a planet an audio clip and an animation plays. I have tried with two different scripts. Here are those scripts.
var PlayerScore : int;
var ScoreText = "Score: 0";
var MaxPoints : int;
function OnTriggerEnter(other : Collider){
if(other.tag == "Point"){
PlayerScore += 1;
ScoreText = "Score: " + PlayerScore;
Destroy(other.gameObject);
}
}
function Update(){
if(PlayerScore > MaxPoints){
PlayerScore = 0;
print("MaxReached");
ScoreText = "Score: 0";
}
GUI.Button(Rect(0,0,10,10),"Start");
}
this did not work. In this script my goal was that after the player got to 10 points while receiving 1 point each time they hit a planet a start button would appear. A score counter was supposed to appear in the corner of the screen. The script didn’t do anything when I attached it to the planets, do I need to attach it to the player? If not if someone could help me with this that would be great. Thanks!