Highscore doesn't save

So I made a game where you have to get points and if you have them all you win, I added a stopwatch and a highscore to it so you could “speedrun” the level, but the highscore won’t save.

    int seconds = PlayerPrefs.GetInt("HighScore", 0);

    bestTimeText.text = PlayerPrefs.GetInt("HighScore", 0).ToString();
    currentTime = 0;
    stopwatchActive = true;
}

// Update is called once per frame
public void Update()
{            
    if(stopwatchActive == true)
    {
        currentTime = currentTime + Time.deltaTime;
    }
    
    TimeSpan time = TimeSpan.FromSeconds(currentTime);
    currentTimeText.text = time.ToString(@"mm\:ss\:fff");

    TimeSpan highTime = TimeSpan.FromSeconds(bestTime);
    bestTimeText.text = highTime.ToString(@"mm\:ss\:fff");

    PlayerPrefs.SetInt("HighScore", (int)time.TotalSeconds);
}

public void SetTime()
{
    TimeSpan time = TimeSpan.FromSeconds(currentTime);
    currentTimeText.text = time.ToString(@"mm\:ss\:fff");

    TimeSpan highTime = TimeSpan.FromSeconds(bestTime);
    bestTimeText.text = highTime.ToString(@"mm\:ss\:fff");

    if (time < highTime)
    {
        print("Highscore!");
        bestTimeText.text = time.ToString(@"mm\:ss\:fff");
        PlayerPrefs.SetInt("HighScore", (int)time.TotalSeconds);
        PlayerPrefs.Save();
    }
}

public void StartStopwatch()
{
    stopwatchActive = true;
}

public void StopStopwatch()
{
    stopwatchActive = false;
}

public void Reset()
{
    bestTime = 600;
}

Hello.

Is difficult to know the problem just by reading the code, you should debugg the code while running and check where the code is not doing what you expect to do. I recommend you to look for youtube tutorials about debugg your code while running, its very simple to do and you will need a lot during programming to detect this kind of problems.

Good luck!