change scene and keep the progress of an instantiated scene

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

Hi, I’m new to this, what I want to do is that when I change a scene, the progress of an instantiated scene is shaken, this is the code of the scene that I want not to be updated at the time of changing the scene.

var vida = 1

func _ready():

$sprite3.hide()

pass 

func _on_1_pressed():
if (vida ==1):
$sprite2.hide()
$sprite3.show()
vida += 1

func _on_bbb_pressed():
get_tree().change_scene(“1 - copia (19).tscn”)
pass

:bust_in_silhouette: Reply From: null_digital

An easy way would be to have a script in AutoLoad to hold the vars you don’t want to lose in scene changes.