When i try to add points when clicked on button it shows NaN?

I made a button named ad1 and also a label named point count i also did some blocks but when i try.It doesn’t work it says NaN.i also initialiased variable (stored) so that when i click on ad1 it add 10 points and stays in the same place means even if i cut that app and reopen it should store. Please help.


It would be helpful if you posted a link to your project.

You have not assigned anything to stored variable Pointcount so that is not going to get saved to the device.

Also, when you use a stored variable, you have to check if its value is null (when screen opens) and if it is, assign it a starting value such as 0.

i did as you said but still shows NaN. here are some screenshots and link of the project.


The two variables shown with the yellow arrows need to be the same variable

And at the bottom of the screenshot, you are setting disableTimestampadone twice when you should be setting Pointcount for the second block.

Also, if you set a stored variable and then change the value being stored, that’s the wrong order. You should set stored variable Pointcount to stored variable Pointcount - 10 and then set Points count's Text to stored variable Pointcount. Otherwise, you are only changing the value being displayed… you’re not changing the value being saved to the device.

This is the code i did and it also worked but there are fews problems -

1- When i click on ad1(button) point shows 10 but when i press back the time automatically gets vanish means there are no points shown. i don’t why and might be they get auto reset at 0 i think.

2 - i want that when i click on ad1 it should add point and it did . but when i click on button 2 it should add 10 points to that point which is already there … Elobrate/Explanation

made a button named ad1 ok and ad2 ok
now when i click on ad1 it shows 10 point ok but doesn’t add 10 point when i click on ad2 to the same points which came on clicking on ad1 button. thankyou sir for helping out.

Can you post an updated screenshot and a new link to your project?


These screenshots are updated one I took them when i did some blocks after you said sir.

But you are mentioning event blocks (ad1 click, ad2 click) that were wrong in the last screenshot and you didn’t provide an updated screenshot. So that’s why I asked for a project link.

You are using different variables to save the points:


If you want the Ad1 and Ad2 buttons to add points to the same sum then you need to use a single variable for that.

Things are working everything is working now I fixed with the help of yours sir.

But only one problem.

When i click on button they count points but when i press back and re enter that screen points aren’t visible. Help me fix this thing please

Do you have blocks that say when screen opens, set label’s text to stored variable Pointcount2?

If so, post a screenshot of those blocks.

Also I want to make a button when we click on that button points should get zero. Please tell me blocks so that I can make this possible

Ok sir wait I’m posting screenshots

These are the screenshots sir.

I haven’t set label set - when screen opens…

Sir please help.

Then I would do that…

And if you want to set a variable to zero, then try to set up blocks for that. If you have trouble, post a new screenshot.

Sir what blocks can you please elaborate? Actually I am just a beginner so can you please tell me blocks which i need to setup?

You can watch the Variables tutorial video here: Variables - Thunkable Docs

It will explain how to use them.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.