Saving a highscore?

I need help saving a high score. I know I need to use something like the saveLocalData function, but I have no idea how. How would I make it save my highscore when the program or app is closed or restarted?
I have something like this to set the highscore, I want to save the variable highScore, but not currentLevel.

if highScore < currentLevel then
    highScore = currentLevel
--And here I want to save the highscore so it wouldn't get deleted, how would I do that?
if highScore < currentLevel then
highScore = currentLevel

I believe you already had a thread about this…

Oh yeah you’re right I did. thank you :slight_smile:

@CodeaNoob do I still need to save highscore as a variable?

This is what I do for initial setups for Highscores;
Note: Score is just what I use, currentLevel would take its place for you

function setup()
if readLocalData("HS") == nil then

When the game is over:

if Score > readLocalData("HS") then

Thank you @CodeaNoob x)
So how would i make that variable appear on the screen?

Nevermind , got it! Thank you @CodeaNoob :slight_smile: