How do I solve a big problem with WebStorage?

0 favourites
  • 7 posts
From the Asset Store
Jump over the small square and avoid hitting it as long as you can!
  • Hi,

    I made a big project ( 600 events) with a 35 layouts and I made something wrong.

    The game is on Google Play.

    So the "big problem" could be also named as money bug.

    So you have in-game money and if you buy something it substracts from the money, all ok here but if you go to the menu and press start and after you return to the menu the money you spend with that ball upgrade are comming back. ( the upgrade + money comes back like before you bought them)

    I don't know what i did wrong. I watched everywhere, I'm not so good at webstorage, don't know why, maybe I didn't uderstand it well.

    Soo... if anyone could help me with this bug please let me you email belov to send you the project file.

    Much Thanks to everyone reads this.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi,

    You need to check how are you initializing the WebStorage. I assume it is initializing it without checking whether it even exist already or not.

    It should be:



    Webstorage "Money" exist:


    Set Webstorage "Money" to 10000

    This way, it will make the Webstorage called "money" to 10000 only if it does not exist. (Which means, only one time even if you come back tomorrow).

    Hope this helps.

  • Hasan999

    Thank you for your reply,

    I don't know i think I made a variable and whenever the variable change save it to localstorage.

    Could you help me If i send you the project?

    I don't know your reply will help, thanks anyway.

  • Radulepy Sure, go ahead. Email me your capx: hasan555x at

    EDIT: Changed it thanks

  • Hasan999

    before please I think i got it ( 3 days )

    So what is the exact code to save a varaiable when changed/on exiting the layout and when i reenter the layout, to load that variable?

  • Radulepy Sure, go ahead. Email me your capx: hasan555x ~cov@~ gmail ^. ^ com

    You might want to change that to something like:

    hasan555x *at* gmail dot com

    The web-crawling bots will find your email, and you will get armadas of spam...

  • Hasan999 Sent You

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)