#Adds an instance of the Main GUI under Lobby
get_tree().get_root().get_child(5).queue_free() #kills lobby menu
get_tree().get_root().add_child(main_scene.instance())
client = get_tree().get_root().get_child(3).get_child(1)
if Database.LOCAL_ID == 0:
if new:
emit_signal("start_game_org")
else:
emit_signal("start_loaded_game")
This is the code for my "startloadinggame" function. I have run it with print messages around the "queue_free" line and it prints out 5 children, with the "StartMenu" being the 5th. However, the prints show that the line does absolutely nothing.
The function itself does not error out. However, after the "startgameorg" signal is sent another function tries to trigger another function in the 5th child of root - which for some reason is still StartMenu. It should be the main_scene instance, which would be the 5th one after StartMenu is freed.
What are the possible reasons this could be happening?