Can you help me do a highscore please? I've got this problem..

if (isdead == false)
{
score += Time.deltaTime * 25;

     scoreText.text = ((int)score).ToString();
     if (scoreText > PlayerPrefs.GetInt("Highscore"))
     {
         PlayerPrefs.SetInt("Highscore", scoreText);
     }
 } // I tried using score instead of scoreText in player prefs btw

You posted some bad code, and said you have a problem. It helps if you post the actual error from the the Unity console.

  1. you’re trying to store the Text GameObject, not it’s text value, this should be scoreText.text

  2. you’ve cast score as a string and trying to store value in int, you should store (int) score.

    //updated
    

    if (isdead == false) {
    score += Time.deltaTime * 25;
    scoreText.text = ((int)score).ToString();
    if (score > PlayerPrefs.GetInt(“Highscore”))
    {
    PlayerPrefs.SetInt(“Highscore”, (int)score));
    }

       }
    

Additionally, I hope this is meant only to be updated after the character reaches end of level. Else, once your character reaches a high score, you start updating PlayerPrefs on each frame. This would kill performance and cause much needless activity.

Edit:
I fixed the “operand > can’t be used…” error. That was bad reading on my part, and maybe the root of the error.

 if (scoreText > PlayerPrefs.GetInt("Highscore"))  // bad

is trying to compare a GameObject is greater than an Integer. should have been:

if (score > PlayerPrefs.GetInt("Highscore"))  // good

Which compares the int ‘score’ with the int ‘Highscore’. This is something the computer can do.