Accessing a variable in another scene with VisualScript

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

My 11-year-old is making her first Godot game, using VisualScript, and I’m trying to help her search for answers. But I haven’t been able to find how to access a variable in another scene using VisualScript.

At first she wasn’t sure how to change scenes in VisualScript, but through trial and error found she could use the Get Scene Tree node, connect it to the “instance” port in a SceneTree.change_scene_to() node, and then connect a Preload node, with “res://theNameOfHerScene.tscn” as the object, to the “packed scene” port in the SceneTree.change object.

I’m guessing it involves using the Get Variable node (not Get Local Variable) and then changing things in the Inspector in some way. But we get errors when we try to do this, including after we made the VisualScript script containing the variable autoload.

Is there perhaps VisualScript documentation covering this and I just haven’t found it?

Any pointers much appreciated!

:bust_in_silhouette: Reply From: Bot7

I dont know with VisualScript but with the Editor you must use autoload.