# Loop Running Behind Dialog

**URL:** <https://forum.makecode.com/t/loop-running-behind-dialog/3518>\
**Category:** Help\
**Created:** [September 17, 2020, 10:19pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518 "2020-09-17T22:19:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![techahoynyc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/techahoynyc/32/1023_2.png) [@techahoynyc](https://forum.makecode.com/u/techahoynyc)\
**Post date:** [September 17, 2020, 10:19pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/1 "2020-09-17T22:19:33Z")

</div>

I have an odd issue in a game I am making, and have managed to reproduce the error with some test code.

The first time through my game, I present the user with some dialog and then once they clear it a loop runs creating some sprites. Once all the sprites are destroyed the dialog is represented, but the second time around the loop actually runs before the dialog box is cleared.

> **[test loop and dialog call](https://arcade.makecode.com/48766-79232-64638-20983)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I’m not sure why this is occurring nor how to fix it. Any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [September 17, 2020, 10:50pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/2 "2020-09-17T22:50:49Z")

</div>

Thank you so much for making such a small repro program!

The issue here is that you’re placing a `pause` block inside of an `on game update`. All the code in the game update loop needs to run before the screen can be drawn, so the code is actually running correctly even though it doesn’t look like anything is happening.

In general, if you want to pause during a game update you should use the `forever` block instead. It’s similar to the game update, but it’s okay to block in it!

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [September 17, 2020, 10:51pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/3 "2020-09-17T22:51:08Z")

</div>

The `forever` block is in the loops category

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [September 17, 2020, 11:46pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/4 "2020-09-17T23:46:26Z")

</div>

isnt that phrase uses every letter in the alphabet without using the same letter

---

<div class="post-metadata">

**Author:** ![techahoynyc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/techahoynyc/32/1023_2.png) [@techahoynyc](https://forum.makecode.com/u/techahoynyc)\
**Post date:** [September 18, 2020, 6:12pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/5 "2020-09-18T18:12:07Z")

</div>

Ah ha! Thanks so much 🙂 it’s working now.

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [November 18, 2020, 8:40pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/6 "2020-11-18T20:40:39Z")

</div>

It uses “w” twice.

---

<div class="post-metadata">

**Author:** ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)\
**Post date:** [November 18, 2020, 8:42pm UTC](https://forum.makecode.com/t/loop-running-behind-dialog/3518/7 "2020-11-18T20:42:53Z")

</div>

And “the”
