Adding a Pause Button

I made a script where if var(Pause) = 1 then the game would pause and it would continue when var(Pause) = 0. It works when I press a key on the keyboard but I want to use the script on a screen button and here is my code


Now the problem is that I was only able to get it to pause but not the other way around. I think the problem is that there is no delay. How do I fix this? Thank you for your help

by the way the quit game was just there for testing purposes

The value of the scene variable “ree” is 0 and the object Game Over is hidden at the beginning of the scene.

The button is NewObject.

This shows/hides the Game Over object when clicking the button(NewObject) repeatedly, since a delay of 0.1s is introduced.

Not an optimal solution, but it works :]

Ok I have tried it and it seems like the game hates me and it just wants to pause itself and I cant unpause it.

I got a pause button that works!

  1. I forgot to put an “oldpause variable” which is part of the system that I made
  2. I reused it to create a delay
    And it works!
    Thank you for your help @Nilarjun!

The only weird thing is that when I put it in a group then it just doesn’t work

2 Likes