show or hiding nodes after current_scene reloaded. Not working?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Archtects

After the game over screen appears you have two buttons. One goes to main menu, Another restarts the game.

This is my GUI Scene
enter image description here
What Scene looks like with gameover menu
enter image description here

Everything is hidden so _ready shows the MainMenu

onready var MainMenu
onready var Overlay
onready var PlayPause
onready var GameVars
var gamestart = true

func _ready():

func gamestart():
	if (gamestart == true):
		MainMenu = get_node("/root/Main/GUI/MainMenu")
		Overlay = get_node("/root/Main/GUI/Overlay")
		get_tree().paused = true
	elif(gamestart == false):
		PlayPause = get_node("/root/Main/GUI/Pause/PausePlay")
		GameVars = get_node("/root/Main/GUI/Game")
		get_tree().paused = false

The on ready works fine. It shows the nodes perfectly. Everything works fine on first run. However when i activate the button pressed code:

func _on_Restart_button_down():
	global.gamestart = false
	global.score = 0
	global.lives = 3

func _on_MainMenu_button_down():
	global.gamestart = true
	global.score = 0
	global.lives = 3

So hit restart or Return to main menu, It refreshes the scene. But seems to ignore the $ or hides?

What am i doing wrong?

Why after get_tree().reload_current_scene() Does it seem to ignore trying to show() nodes? Thank you.

Have you tried moving the get_tree().reload_current_scene() to be the last line in those functions? I’m not sure, but perhaps calling reload_current_scene stops execution (i.e. doesn’t return) since the node the script is attached to doesn’t exist any more when the scene is reloaded.

markopolo | 2018-10-06 00:50