Having trouble with local High Score script

Hello I’m working on a script to save the score the player has achieved and, if it’s their best score, to display it as the highest score like this: ‘Highest Score: …’

I’m using Player Prefs to save the score. The script is attached to the same game object as my point scoring script:

GetComponent("ScoringScript");
function AddScore(score : int){
   var newscore : int;
   var oldscore : int;
   newScore = score;
   for(i=0;i<10;i++){
      if(PlayerPrefs.HasKey(i+"HScore")){
         if(PlayerPrefs.GetInt(i+"HScore")<newScore){ 
            oldScore = PlayerPrefs.GetInt(i+"HScore");
            PlayerPrefs.SetInt(i+"HScore",newScore);
            newScore = oldScore;
         }
      }else{
         PlayerPrefs.SetInt(i+"HScore",newScore);
         newScore = 0;
      }
   }
}

What I’m having some trouble with is the script I’m using to display the highest score in another scene. Here is the script:

var HighestScore : int;

function UpdateHScore(){

   HighestScore = PlayerPrefs.GetInt(0HScore);

}

The console is saying: expecting ‘)’, found ‘HScore’ and on the same line unexpected token: ). I’m not sure what to do here.
The last thing I’m having trouble with is displaying this script on the GUI. Is there a way to incorporate

to do so?

Thank you very much for any answers or feedback. I apologise for my lack of knowledge, I’m still having a go.
-Ben

I think you need to convert your index to string and then split the results back up using a parse. Just a guess lol.

I have never seen prefs looped like that before.

0HScore should be a string.

(“0HScore”)

Thank you, that did the trick