# Javascript Pause code not working

**URL:** https://forum.makecode.com/t/javascript-pause-code-not-working/18109
**Category:** Help
**Created:** [February 21, 2023, 10:58pm UTC](https://forum.makecode.com/t/javascript-pause-code-not-working/18109 "2023-02-21T22:58:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Spaghetti\_Coder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spaghetti_coder/32/6890_2.png) [@Spaghetti\_Coder](https://forum.makecode.com/u/Spaghetti_Coder)
#### Post date: [February 21, 2023, 10:58pm UTC](https://forum.makecode.com/t/javascript-pause-code-not-working/18109/1 "2023-02-21T22:58:06Z")

</div>

> **[Pause Test](https://arcade.makecode.com/S91669-49977-46034-70776)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

In the forums I saw that there was a way to pause a game using scenes, by using the “game.pushScene()” and “game.popScene()” code.

However when I do this, the game can pause, but I can not unpause it. I do not know if I am just coding it wrong, but if someone could help me with this then it would be much appreciated, as I would like to make a custom pause menu for my games.

---

<div class="post-metadata">

### Author: ![Spaghetti\_Coder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spaghetti_coder/32/6890_2.png) [@Spaghetti\_Coder](https://forum.makecode.com/u/Spaghetti_Coder)
#### Post date: [February 25, 2025, 9:36pm UTC](https://forum.makecode.com/t/javascript-pause-code-not-working/18109/2 "2025-02-25T21:36:58Z")

</div>

Just wondering if I can get any clarification on this, since I’m trying to get back into Makecode. Hopefully it can be figured out? Not a super big deal, but I would love to have custom pause screens in my game, instead of the default menu

---

<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: [February 25, 2025, 9:49pm UTC](https://forum.makecode.com/t/javascript-pause-code-not-working/18109/3 "2025-02-25T21:49:00Z")

</div>

@Spaghetti_Coder all event handlers are tied to the current scene. the sequence of events for this game looks like this:

1. game starts. the “on menu button pressed” handler is registered on the initial scene
2. you press the menu button
3. the menu button event handler calls push scene
4. a new scene is created that takes the place of the initial scene. this new scene does _not_ have your “on menu button pressed” code registered in it (remember, that code was run on the start scene)
5. you press the menu button a second time
6. the default menu button handler runs which opens the system pause menu

the easiest way to fix this is to call the “on menu button pressed” function a second time after push scene is called. unfortunately, that isn’t something you can do in blocks; you’ll have to do it in javascript
