HighScore system isnt working

when you get a score and you reaload the scene it will be back at 0 so my highscore will stay at 0. how do i fix it?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.SocialPlatforms.Impl;

public class ScoeScript : MonoBehaviour

public static int scoreValue = 0;
public TextMeshProUGUI Score;
public Text Highscore;

// Start is called before the first frame update
void Start()
    Score = GetComponent<TextMeshProUGUI>();
    Highscore.text = PlayerPrefs.GetInt("HighScore", 0).ToString();

// Update is called once per frame 
void Update()
    Score.text = "Score: " + scoreValue;
    Highscore.text = scoreValue.ToString();

    if(scoreValue > PlayerPrefs.GetInt("HighScore", 0))
        PlayerPrefs.SetInt("HighScore", scoreValue);


You are setting the high score display to be equal to the current score (zero at the time of scene loading), regardless of what the current score is.

I think you probably intend to place your “Highscore.text = scoreValue.ToString();” line within your if statement.

it worked! thank you so much.