Do the scenes work on their own though? If you go into scene two, and hit "run as scene" (the little movie player icon in the top right) does it work? The reason I ask is that, if the scenes work on their own, it should work when the scenes are changed too.
Looking at the error and what is happening, my guess is that scene two is getting the tween node and/or player_bar
from scene one, which causes problems when the scene is deleted. How are you assigning the player_bar
variable?
Another thing you could try is adding yield(get_tree(), "idle_frame")
after stage_level.queue_free()
and see if that helps. It would delay the code for a single frame, which would give the first scene time to be for sure deleted before adding the new scene. If scene two is getting something from scene one, waiting a single frame should make it where scene one is completely removed, making scene two unable to get any nodes from it when it's instanced.
Though you can also use get_tree().change_scene("Path_To_TSCN_file_here.tscn")
too, if you just want to load an entirely new scene and unload everything else. Though if you are making a loading screen, loading in a separate thread, or have a different reason to keep parts of the scene around, then adding and removing the scene flies like you are doing currently is probably best.