# Lag problem

**URL:** <https://forum.makecode.com/t/lag-problem/35020>\
**Category:** Help\
**Created:** [March 30, 2025, 5:03am UTC](https://forum.makecode.com/t/lag-problem/35020 "2025-03-30T05:03:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danihiro](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@Danihiro](https://forum.makecode.com/u/Danihiro)\
**Post date:** [March 30, 2025, 5:03am UTC](https://forum.makecode.com/t/lag-problem/35020/1 "2025-03-30T05:03:05Z")

</div>

Can somebody please review my code and tell me how to fix this sudden lag spike whenever the code goes through an if statement, it’s been an hour and i haven’t been able to figure it out.

> **[Hmalet - Copy - Copy](https://arcade.makecode.com/S56074-01421-51474-72983)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<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:** [March 30, 2025, 7:49pm UTC](https://forum.makecode.com/t/lag-problem/35020/2 "2025-03-30T19:49:58Z")

</div>

Hello and welcome to the Makecode Forum! It looks like the Story extension uses the pause function to pause blocks of code, so that the next block doesn’t run until the current one stops.  
This works well for stories, which are long strings of story blocks one after another, but when you use a pause inside certain blocks, it freezes your whole game until the pause ends! The “update sprite every…” block you are using is one of these freezing blocks. Instead, since you only have one sprite, you can put the code into a Forever block, like this:

 ![IMG_8205](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/8/b866694f2c3bda7f53532ad57d5394f1f7291a7e.jpeg)  
Forever blocks don’t freeze up when the code pauses, so it should work well for what you are doing!

---

<div class="post-metadata">

**Author:** ![Danihiro](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@Danihiro](https://forum.makecode.com/u/Danihiro)\
**Post date:** [March 31, 2025, 4:55pm UTC](https://forum.makecode.com/t/lag-problem/35020/3 "2025-03-31T16:55:02Z")

</div>

It worked thank you very much you have taken a huge problem of my back, again thank you.
