# How to fix stored variable when clicked showing NaN

**URL:** <https://community.thunkable.com/t/how-to-fix-stored-variable-when-clicked-showing-nan/2440660>\
**Category:** Questions about Thunkable X\
**Tags:** beginner\
**Created:** [May 29, 2023, 4:19am UTC](https://community.thunkable.com/t/how-to-fix-stored-variable-when-clicked-showing-nan/2440660 "2023-05-29T04:19:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharth.gamer09x](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@siddharth.gamer09x](https://community.thunkable.com/u/siddharth.gamer09x)\
**Post date:** [May 29, 2023, 4:20am UTC](https://community.thunkable.com/t/how-to-fix-stored-variable-when-clicked-showing-nan/2440660/1 "2023-05-29T04:20:00Z")

</div>

I made a label named point count and also a button named ad1 i want that when i click on ad1 it should count point but when i click on it shows NaN. and i am using stored variable so that i can store value even if i close and restart the application. If i use app variable things are working but it is not storing value when i press back it just reset point count. how can i fix this thing.

![new](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/b/4bb9f4a18b81c27a995bbe369588b68764fbf93d.png)  
 ![Screenshot 2023-05-29 093906](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/d/a/da48ef3236b0015d3b60d4771093e137cd281830.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 29, 2023, 4:32am UTC](https://community.thunkable.com/t/how-to-fix-stored-variable-when-clicked-showing-nan/2440660/2 "2023-05-29T04:32:53Z")

</div>

When you use stored variables, you have to give them a starting value. The way you do this is to put an if block in the when screen opens block.

If variable = null  
Set variable to 0

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [August 27, 2023, 4:32am UTC](https://community.thunkable.com/t/how-to-fix-stored-variable-when-clicked-showing-nan/2440660/3 "2023-08-27T04:32:56Z")

</div>

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