# Keeping score

**URL:** <https://forum.kirupa.com/t/keeping-score/323173>\
**Category:** Uncategorized\
**Created:** [June 20, 2011, 1:32am UTC](https://forum.kirupa.com/t/keeping-score/323173 "2011-06-20T01:32:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tripolinero](https://avatars.discourse-cdn.com/v4/letter/t/f19dbf/32.png) [@Tripolinero](https://forum.kirupa.com/u/Tripolinero)\
**Post date:** [June 20, 2011, 1:32am UTC](https://forum.kirupa.com/t/keeping-score/323173/1 "2011-06-20T01:32:51Z")

</div>

i am making a small game and after finishing g the hit test to keep my character on top of the moving objects on the stage i wanted to keep the score so i added this little piece of code to one of the already available functions in the code but it only counts the score once and does not increment it why ?

var score:String

```
//loop to check if the char hit the line on top & bottom of the step or not.
for (var i = 0; i&lt;steps; i++)
{
if (ball.hitTestObject(lineBot*))
    {
        SpaceKeyStatus = "spaceReleased";
        
    }
    

if (ball.hitTestObject(lineTop*))
    {            
            ball.y=lineTop*.y-ball.height;
            score +=10;
            score_txt.text = score
    }
}
```
