# Adding dynamic variable

**URL:** <https://forum.kirupa.com/t/adding-dynamic-variable/312479>\
**Category:** flash\
**Created:** [August 4, 2010, 1:52pm UTC](https://forum.kirupa.com/t/adding-dynamic-variable/312479 "2010-08-04T13:52:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kekekiko](https://avatars.discourse-cdn.com/v4/letter/k/b4bc9f/32.png) [@kekekiko](https://forum.kirupa.com/u/kekekiko)\
**Post date:** [August 4, 2010, 1:52pm UTC](https://forum.kirupa.com/t/adding-dynamic-variable/312479/1 "2010-08-04T13:52:54Z")

</div>

I have a ‘root’ score called ‘myscore’ and created a game that adds to a different score in that game titled ‘gamescore’.

I have successfully created the scoring system for the game eg

on press - gamescore +=1;

This works fine but during the game I would like the users to ‘bank’ their score to their overall total ‘myscore’. I am not sure how to add a dynamic variable ‘gamescore’ to the root score.

I have tried

myscore += gamescore;

but it doesn’t work. How do I get the gamescore to add to the rootscore. I know I could just put

on press - gamescore +=1;  
myscore +=1;

but if they lose the game they lose their points so the banking of the points is important. Like declaring their runs in cricket…which is actually the game!

thanks
