# My game got a bug, but idk why

**URL:** <https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237>\
**Category:** Help\
**Tags:** game\
**Created:** [May 29, 2026, 10:29pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237 "2026-05-29T22:29:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ytrza4512](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@ytrza4512](https://forum.makecode.com/u/ytrza4512)\
**Post date:** [May 29, 2026, 10:29pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237/1 "2026-05-29T22:29:43Z")

</div>

my game is a pokemon game. when in battle, when my ennemy attack, i got a error that says : the block “if” need a list. what ? and apparently, it’s a variable that need to be a list, because it’s undefined, but the block above defind it ! here is my code

> **[Pokemon special versio (buggy)](https://arcade.makecode.com/S87851-46880-59123-35995)**
>
> Help ! it bug

---

<div class="post-metadata">

**Author:** ![ScriptScraper](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/scriptscraper/32/35438_2.png) [@ScriptScraper](https://forum.makecode.com/u/ScriptScraper)\
**Post date:** [May 30, 2026, 5:22pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237/2 "2026-05-30T17:22:52Z")

</div>

I fixed it! The problem was the “Pause until enemy health \< 1” block, but I have no idea why it was broken.

> **[Pokemon special version](https://arcade.makecode.com/S60118-71343-72060-31396)**
>
> Fixed :)

---

<div class="post-metadata">

**Author:** ![Vincent](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vincent/32/31472_2.png) [@Vincent](https://forum.makecode.com/u/Vincent)\
**Post date:** [May 30, 2026, 11:20pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237/3 "2026-05-30T23:20:36Z")

</div>

Ton jeu est très cool, @ytrza4512! J’ai déjà essayé de faire un jeu de pokémon aussi (Cherche-le si tu veux, tu peux utiliser les pokémon qui existent déjà mais il faudrait demander à @Chicken_joe si tu veux utiliser ceux qui n’existent pas réellement. Si tu veux, je pourrais t’aider avec ton jeu! =D (Chicken Joe, so you don’t have to translate everything, I’m giving him permission to use the templates in my old Pokémon, but to use yours, he still needs permission from you!)

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [May 30, 2026, 11:23pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237/4 "2026-05-30T23:23:33Z")

</div>

The problem was the timers “after (500) do” block. Because this block makes your code able to run at the “same time” as other code, as soon as the “Change [HP Ennemi] by (-20)” code runs, the “Wait Until” block runs, but because now the game is in the “show long text” scene context, the tilemap and sprites get stored for later. This means that when the game tries to run the code after the Wait Until block, those sprites and tilemap stuff don’t exist and this causes an error. Simply removing the “after (500) do” block and replacing it with the normal green “pause()” block will fix the issue!

 ![Screenshot 2026-05-30 at 5.37.45 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/5/05098bca2c9e3d46ddc850625611de8942460428.png)  
This code works!

---

<div class="post-metadata">

**Author:** ![Chicken\_joe](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/chicken_joe/32/29275_2.png) [@Chicken\_joe](https://forum.makecode.com/u/Chicken_joe)\
**Post date:** [June 1, 2026, 9:25pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237/5 "2026-06-01T21:25:38Z")

</div>

Oh well, I give my permission.

---

<div class="post-metadata">

**Author:** ![ytrza4512](https://avatars.discourse-cdn.com/v4/letter/y/87869e/32.png) [@ytrza4512](https://forum.makecode.com/u/ytrza4512)\
**Post date:** [June 9, 2026, 3:52pm UTC](https://forum.makecode.com/t/my-game-got-a-bug-but-idk-why/44237/6 "2026-06-09T15:52:59Z")

</div>

you’re the best, thank you !
