PlayerPrefs not working on android

Hi, I am working on a game and I am able to make a high score system using PlayerPrefs. But when I build my project to my android device the high score is the same as on my pc and when I get a higher score, the high score text doesn’t update. Note this only happens on my android device. Everything works well on pc. How would I fix this? Any help is appreciated.

using UnityEngine;
using TMPro;
using UnityEngine.SceneManagement;
using System;
using System.Diagnostics;


public class Score : MonoBehaviour
{

    public TextMeshProUGUI scoreText;
    public TextMeshProUGUI scoreAtEndText;
    public TextMeshProUGUI highscoreText;
    public TextMeshProUGUI newBestText;

    public Player player;

    public float score;

    public bool scoreIncrease = true;

    void Start()
    {
        highscoreText.enabled = false;
        highscoreText.text = "BEST: " + PlayerPrefs.GetFloat("Highscore", 0).ToString("0");
        PlayerPrefs.Save();
        highscoreText.ForceMeshUpdate(true);
        highscoreText.enabled = true;
    }

    void Update()
    {
        if (scoreIncrease) { score += Time.deltaTime * 60; }
        else { score += 0; }

        scoreText.text = score.ToString("0");
            
        scoreAtEndText.text = "SCORE: " + score.ToString("0");

        if (score > PlayerPrefs.GetFloat("Highscore", 0))
        {
                PlayerPrefs.SetFloat("Highscore", score);
                PlayerPrefs.Save();
                highscoreText.text = "BEST: " + score.ToString("0");
                newBestText.gameObject.SetActive(true);
        }
    }
}

I think you got this problem because when testing your code in the editor, you never reset all the PlayerPrefs keys. So because the values already exist in the editor, there isn’t a problem but when you start fresh (on android) there is.

In your case, you don’t need a parameter for the .ToString() function I believe.

PlayerPrefs.GetFloat(“Highscore”, 0).ToString();
should be sufficient.

Also in the Update() function you don’t necessarily need the default value, as you set it in the Start() function earlier.