I have this currently in-game: on death -> Localstorage set item "savedCoins" to invCoins (global variable that adds coins when picked up).
And that part is working, when I'm going back to the menu, it still shows the amount. But when I refresh the page, it resets to 0. Why is that? Pictures of the events are below:
This is the part actually saving it.
This is the part setting the saved integer to my global variable.
Why won't it save when I refresh the page? Does this not work on preview in browser, for some reason?