HighScore Gui Text (Error) Please Help! :)

This is my script,I want that the “number” (variable Counter) saved in an earlier scene It script looks if it is over the highscore and if it is save it and remember it as a highscore in another scene, I dont know that bad: S this is the one I use for another scene:

var Counter : int;
 
function Start(){
Debug.Log(Counter);
Counter = PlayerPrefs.GetInt("Score");
guiText.text = "Score: "+Counter;
}

and it works for me but now another scene and saved as highscore failing me that not only saves the previous runs, and I want to save the highest and if is lowest do nothing. What could I do?

var Counter: int;
var highscore: int;
 
 
function Start (){
   Counter = PlayerPrefs.GetInt("Score");
   
  
}
function Update (){
 
if(Counter>highscore);
{
      highscore = Counter;
      guiText.text = "Normal Map HighScore : " +highscore.ToString();
      PlayerPrefs.SetInt("highscore",highscore);
 
 
}
}

Thanks, I wish it running!.

Try using PlayerPrefs.Save after the SetInt.

Ok, I understood it wrong. So you just need to save your Counter variable to the PlayerPrefs too (and replace back line 6, as what I suggested is wrong).

Are you sure that you saved the ‘counter’ in the previous scene?