If (x > y); set y = x; [c#]

Hello!
I want to display the players score. I want to display last score, and highest score.
How do I script highest score using c#?

I’m trying to do something like that:

	if (NewScore > PlayerPrefs.GetInt("Max Score")){
		PlayerPrefs.SetInt("Max Scoret", NewScore );
		MaxScoreText.text = ("Your max score is: " + PlayerPrefs.GetInt("Max Score"));
	}
	else {
		MaxScoreText.text = ("Your max score is: " + PlayerPrefs.GetInt("Max Score"));
	}

The code does’t work because when you call GetInt you look for “MaxScore” but when you try to retrieve it, you are asking for “Max Score” (with a space) So you’ll need to make all of them the same

You may have to add something like this too:

void Start(){
   if(!PlayerPrefs.HasKey("MaxScore")) PlayerPrefs.SetInt("MaxScore",0);
}