High score in endless runner

Hey guys, we’re trying to make an endless runner as massive beginners to the progamming and game-making world, and we’ve managed to make the high score save even after closing the game and opening again, but only in the Gdevelop “tester”, where you play the game in-engine? It works perfectly there, but simply doesn’t work when exported to my Android.

Here is the code involved. Again, somehow works just fine in-engine, but not on Android or in browser.

The Filesystem documentation states:

This works only on Windows, Linux and MacOS. Mobile games and web games are currently not supported.

I suggest you use the Storage functions. They work everywhere, I checked on my training project: Dashing Ball ("Hello world" project)
To write, you need the “Write a value” function, to read “Read a value”:

Thanks. I can only find examples with single scenes, and I’m trying to display high score on the main scene, while “Level 1” is where the game is played. Right now I’m trying:

Beginning of scene: Read "Hscore" from storage "data" and store value in Hscore

When player dies: The scene variable Score > Variable(Hscore) -> WRite Variable(Score) in "Hscore" of storage "data"

Then in the main scene:

Read "Hscore" from storage "data" and store value in Hscore
Change the text of Hscore: set to ToString(Variable(Hscore))

but the High score doesn’t update, it remains 0.

Check again, there may be an error, here is an example of working in two scenes:



As you can see, the code is the same.

1 Like

works now, thanks a lot for the help!

1 Like