Score and high score

How can I make high score on the main menu?

Use storage to save the global variable so when later you show the main menu get the score variable from Storage and display the value.
Here is an example of save&load

1 Like

I want the score showed on the main menu without saving.
So when the game over and the player goes back to the main menu the last high score achieved will be display on the main menu.
With storage, I have to save the game.

Your second event is all you need in your main menu scene.
Global variables keep their value when changing scenes.

Wow, thanks its actually solved it. I was so blind it was in front of me this all time!!!

By the way I want the highest score ever achieved will be on the main menu until someone else will achieve even a higher score.
Now it shows the score of the last game regardless to the highest score ever achieved.
How can I do that?

Iv tried the example your attached multiple time and still can get any results.
Now I try a differed way, and it’s also not working the logic dictate its should work.
Its just keep show me the last score of the last game.

That’s what the code on your screenshot does.
If the last score is less than the highscore, then display the last score.

You try to compare the text of your text object with the global variable. strings as numbers.
That doesn’t work.

What you want is to compare the value of the scene variable with the value of the global variable.

Right. Also, if the last score is more than the high score still its follow the last game played score.

Still show me the score of the last game played

Variables are case sensitive. “score” ,with a lower case ‘s’ as in the condition is different to “Score” with an upper case ‘s’ as in the action.

[edit]
Also, where are you setting the variable highscore of object highscore? Yo are comparing it, but not setting it. And I’d suggest you change the name of your text object to somethign like highScoreText. It’ll take away the confusion between the object and it’s variable.

1 Like

Yes of course :grin:
you change the text to “Score” where the score of the last game played is saved.
don’t use global variables.
save and load the highscore

1 Like

What Mr men is saying
Object variable score of text object score and scene variable score are totally different things and are not related in any way.

You need to understand that
Global variables / object variables / scene variables are all their own values and have nothing to do with each other, even if they have the same name

1 Like

I don’t understand why you’re not just use Storage to solve this. Two lines of code…

I tried what jack proposed without successes.
Can you upload screenshot of your solution?

Here is a game project to show you how to do it.
https://drive.google.com/file/d/1ApgVcw92P062745y4C9RKy8bUah8fHEY/view?usp=sharing