# Exercise global.Score help!

**URL:** <https://forum.kirupa.com/t/exercise-global-score-help/189840>\
**Category:** Uncategorized\
**Created:** [June 6, 2006, 4:18pm UTC](https://forum.kirupa.com/t/exercise-global-score-help/189840 "2006-06-06T16:18:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Largo](https://avatars.discourse-cdn.com/v4/letter/l/41988e/32.png) [@Largo](https://forum.kirupa.com/u/Largo)\
**Post date:** [June 6, 2006, 4:18pm UTC](https://forum.kirupa.com/t/exercise-global-score-help/189840/1 "2006-06-06T16:18:37Z")

</div>

Hi, im trying to get this AS to work. The only thing it needs to do is when you press the right answer-button it should add a point to the global score( globalscore + 1) and when the global score gets to its maximum then the timeline starts playing to the end. The wrong answers are not suposed to do anything. The right answers are “æ(ae)”(an icelandic letter:)) and below “i”(see fla. file). I just cannot figure out what´s wrong…

Can someone help me:)?

**The right-answer button code:**

```auto
on (press) {
 _global.score++;
 _root;
 gotoAndPlay("start");
 tellTarget ("/sael") {
  gotoAndPlay("byrjun");
 }
}

```

**The first frame code:**

```auto
 
stop();
_global.score = 0;
_global.maxscore = 2;
if (_global.score>=_global.maxscore) {
 _root;
 gotoAndPlay(2);
}

```

---

<div class="post-metadata">

**Author:** ![ieatcotten](https://avatars.discourse-cdn.com/v4/letter/i/3da27b/32.png) [@ieatcotten](https://forum.kirupa.com/u/ieatcotten)\
**Post date:** [June 7, 2006, 2:26am UTC](https://forum.kirupa.com/t/exercise-global-score-help/189840/2 "2006-06-07T02:26:44Z")

</div>

try this

first frame code:

```auto

stop();
var score = 0;
var maxscore = 2;
function testScore(){
    if (score>=maxscore) {
        gotoAndPlay(5);
    }
}

```

correct button code:

```auto
on (press) {
    _root.score++;
    gotoAndPlay("start");
    tellTarget ("/sael") {
        gotoAndPlay("byrjun");
    }
    _root.testScore();
}

```
