[Solved] how can I save user points to the users device?

Hi all!

In my app, I need to save a number that a label is changed to, so that when the user leaves and re-enters the app, they number is still the same, instead of being reset to 0. In more detailed manner, I am saying that I have made point system. I want the points to remain same after restarting the app instead of going back to zero

1 Like

You can save the value in localStorage or any other data sources if you want it on the “cloud”.

2 Likes

Hi thanks for the reply
can you send the code for it

Please stop spamming the forum by asking for the same thing over and over again.

As you’re new it’s best to try something yourself instead of asking for ready made code. That way you will learn something.

1 Like

i already tried man’
and i literally asked after2-3 hours because i hav a due date for my project

Show us what you tried.

Can you show blocks of what you’ve tried so we can guide you better? It’s helpful for others too! :slight_smile:

hi will share the code but i hve been getting another error that “internal error generating code from blocks”


this is the code i tried

and also can you give me your discord id so we can talk more easily there

I’m fairly certain you need to change this

And instead set the variable when this screen opens using the screen opens block

Although it can be plugged into an initialize block, I believe they don’t work that way. You must set the value when using a data source block somewhere other than the initialization block.

1 Like


now is it fine??

1 Like

You need to fill the for row id. Currently it is left blank. You need to put a number. For example use 1 for the first row in your table.

image


when im previewing the value is coming 0 only

The problem is that you are storing the score in two places: a variable and a data source but not updating both when the user enters a different score.

Move the Update Value block up one spot. You need to update the data source before setting the score variable.

If you still can’t get the score to display correctly, provide a link to your project and tell us which screen has the problem.

my points worked now

1 Like

Great! Feel free to mark my comment as a solution so this topic gets updated.


this is the code that worked

1 Like

Thanks for sharing what worked for you!