# Score recognition, trouble ending game

**URL:** <https://forum.kirupa.com/t/score-recognition-trouble-ending-game/112037>\
**Category:** Uncategorized\
**Created:** [June 2, 2004, 10:30pm UTC](https://forum.kirupa.com/t/score-recognition-trouble-ending-game/112037 "2004-06-02T22:30:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sektor](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Sektor](https://forum.kirupa.com/u/Sektor)\
**Post date:** [June 2, 2004, 10:30pm UTC](https://forum.kirupa.com/t/score-recognition-trouble-ending-game/112037/1 "2004-06-02T22:30:13Z")

</div>

I want a game to end when the player reaches a score of 2500. I tried an if statement and a go to and play command but neither have worked. Here’s what the code calculating the score looks like:  
(NOTE: This code works fine)

onClipEvent (enterFrame) {  
this.\_x+=laserMoveSpeed;  
if (this.\_x\>600){  
this.removeMovieClip();  
}  
for (i=1; i\<=\_root.numEnemy; i++){  
if (this.hitTest( \_root[“enemy”+i])){  
\_root.score+=100;  
\_root[“enemy”+i].gotoAndPlay( 2 );  
}  
}  
}

I tried doing something like this:

onClipEvent (enterFrame) {  
this.\_x+=laserMoveSpeed;  
if (this.\_x\>600){  
this.removeMovieClip();  
}  
for (i=1; i\<=\_root.numEnemy; i++){  
if (this.hitTest( \_root[“enemy”+i])){  
\_root.score+=100;  
\_root[“enemy”+i].gotoAndPlay( 2 );  
if ( score \>= 2500 )  
gotoAndPlay ( 5 );  
}  
}  
}

but it didn’t work. Can I get a helping hand to tell me what I’m doing wrong?
