# How do I change the level based on score?

**URL:** <https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499>\
**Category:** Help\
**Created:** [June 2, 2021, 8:46pm UTC](https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499 "2021-06-02T20:46:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GoMustangs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gomustangs/32/4323_2.png) [@GoMustangs](https://forum.makecode.com/u/GoMustangs)\
**Post date:** [June 2, 2021, 8:46pm UTC](https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499/1 "2021-06-02T20:46:49Z")

</div>

I’m trying to figure out how get my game to go to a new level once you reach a certain score.

There are keys, when the duck overlaps the keys the score goes up by 1, and I want it to go to level two when the duck has five points.

I have an if statement that calls a function to create level two if the score reaches 5, but when I gather five keys the level doesn’t change.

Any suggestions?

> **[duck quest](https://arcade.makecode.com/73537-86705-60321-97672)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![LaserFoxPro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/laserfoxpro/32/4105_2.png) [@LaserFoxPro](https://forum.makecode.com/u/LaserFoxPro)\
**Post date:** [June 2, 2021, 9:09pm UTC](https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499/2 "2021-06-02T21:09:17Z")

</div>

use a variable, increase it when the score gets higher and make it so that if the variable equals 5 then the level changes

---

<div class="post-metadata">

**Author:** ![ThunderDrop180](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thunderdrop180/32/6820_2.png) [@ThunderDrop180](https://forum.makecode.com/u/ThunderDrop180)\
**Post date:** [June 2, 2021, 9:11pm UTC](https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499/3 "2021-06-02T21:11:42Z")

</div>

Fixed it! i added a Variable called “Score.” i put the change (Variable) score to plus one when key hit, and when B pressed it asks it (Variable) score is at 5, if it is it switches to next level.

> **[duck quest](https://arcade.makecode.com/50052-48710-52840-41697)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![GoMustangs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gomustangs/32/4323_2.png) [@GoMustangs](https://forum.makecode.com/u/GoMustangs)\
**Post date:** [June 2, 2021, 9:19pm UTC](https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499/4 "2021-06-02T21:19:20Z")

</div>

Thanks. I’ll try to recreate what you did!

---

<div class="post-metadata">

**Author:** ![GoMustangs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gomustangs/32/4323_2.png) [@GoMustangs](https://forum.makecode.com/u/GoMustangs)\
**Post date:** [June 2, 2021, 9:19pm UTC](https://forum.makecode.com/t/how-do-i-change-the-level-based-on-score/8499/5 "2021-06-02T21:19:22Z")

</div>

I’ll try that. Thanks!
