# Action when target score reached

**URL:** <https://forum.kirupa.com/t/action-when-target-score-reached/188178>\
**Category:** flash\
**Created:** [May 5, 2006, 4:08am UTC](https://forum.kirupa.com/t/action-when-target-score-reached/188178 "2006-05-05T04:08:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kilvano](https://avatars.discourse-cdn.com/v4/letter/k/f4b2a3/32.png) [@kilvano](https://forum.kirupa.com/u/kilvano)\
**Post date:** [May 5, 2006, 4:08am UTC](https://forum.kirupa.com/t/action-when-target-score-reached/188178/1 "2006-05-05T04:08:14Z")

</div>

Im new to Flash and prefer to learn myself but this one has be stumped.

I recently completed the tutorial on kirupa for creating a platform game.  
[http://www.kirupa.com/developer/mx2004/platform\_game.htm](http://www.kirupa.com/developer/mx2004/platform_game.htm)

Ive edited the level so they include a lot more “pick ups” and bad guy" and it all works dandy.

Ive gone ahead and create 3 other levels using a similar technique and when the user collects 20 coins then they go onto the next level. Im not entirely sure how to do that is the problem.

I tried adding this code to the pick up items but it doesnt work.

if (\_root.score == 20) {  
gotoAndStop(5);

Frame 5 has the second level and frame 7 has the 3rd level.  
The pick up item code before i changed it was

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.char)) {  
// if this hits the char (\_root.char)  
\_root.score.text++;  
// \_root.score goes up 1  
unloadMovie(this);  
// this movie clip is unloaded  
}  
}

Can anyone give me a hand on how to do this. I just need it linking from one level to the next once the user has the desired score.

Many Thanks in advance

Chris
