add highscore function, save it on lvl reset, save after app closes?

First of all, thx for clicking on this, please be my hero on this one.

This is my simple score script; for every click there’s one point added. What I desperately want and I’m unable to achieve, and I did research but still can’t get it, is for the highest number showed by the counter to be saved as a highscore.

When the player dies, the level restarts, so have that in mind.

Also, it is an android project.

the script
#pragma strict

var score : int;

 

function Update () {

        if(Input.GetKeyDown("mouse 0")){        //Player kills the dragon or spaceship or whatever

                score += 1; //increase the score

        }

       

        guiText.text = score + " "; //Display the score to the user!

        

        }

easily with another variable;

var highScore : int;

function Start(){
    if(!PlayerPrefs.HasKey("highScore")){
        highScore = 0;
    } else {
        highScore = PlayerPrefs.GetInt("highScore");
    }
}

On level restart or exit

if(highScore < score){
    PlayerPrefs.SetInt("highScore", highScore);
}