Create two global variables: g_score, g_hiscore.
Add the Local Storage object to your project.
Add this code to the start of your main event sheet:
1. System|On start of layout: LocalStorage|Check item "savehiscore" exists
2. LocalStorage|On item "savehiscore" exists: System|Set g_hiscore to LocalStorage.ItemValue
3. LocalStorage|On item "savehiscore" missing: System|Set item "savehiscore" to 0
This code checks whether you've already saved a hiscore to Local Storage - if you have it loads that value into your g_hiscore global variable, if you haven't it creates the item in Local Storage and then assigns it the value of 0.
During your game session add whatever points you are scoring to g_score.
At the end of the game session and before you start the next session add the following code into your event sheet:
Edit: I forgot to include a trigger once:
>>System| if g_score>g_hiscore: System|Set g_hiscore to g_score; LocalStorage| set item "savehiscore" to g_hiscore
This code checks whether g_score is greater than g_hiscore and if so updates "savehiscore" in LocalStorage.
If you've accessed other items in LocalStorage between retrieving "savehiscore" at the start and updating it at the end you may need to retrieve it again before updating (I think? Maybe someone can confirm)
Hope that helps!