*JavaScript* High Score help (Need help with player prefs)

I have to make a high score display on the game over and menu scene, Right now I have just once you die, it displays the score you had gotten from that run on the game over scene and then resets wen you go back to menu. I have no idea how to use player prefs at all. No idea how to save or retrieve date from it. Basically I need to save the scores I get and then make the one with the highest value display on a different (the gameover and menu) scenes.

Score Script(JAVA):

static var CurrentScore : int;
var InternalScore : int;

var ScoreText : GameObject;

function Update () {


    InternalScore = CurrentScore;
    ScoreText.GetComponent.<Text>().text = "" + InternalScore;
}

Thanks!

There are pretty much two functions that you will need to worry about with PlayerPrefs.

 PlayerPrefs.SetInt("High Score", InternalScore);

This function will assign the value of your score to the key of “High Score”.

var Score = PlayerPrefs.GetInt("High Score", 0);

This function will let you retrieve your score from playerprefs using the key that you assigned previously. You will probably want to place this in the Start function when you are loading your object. The second parameter is the default value if it doesn’t already exist in PlayerPrefs.

More details about the various functions in PlayerPrefs can be found in Unity’s documentation: