You can create a value.
When the back button is pressed: set value to 1
Then in the repeat forever have all the code in a check once if value = 0
For the triangle code, also have a new thing saying that
When value = 0: set invisibility to 100.
This might work.
Also when the game is "playing" set the value to 0
I hope this works.