Invalid get index 'firsttime' (on base: 'null instance').

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

I have a script on the menu scene, that gets the value of a variable on my main scene (the Main node is the parent)

if get_node("/root/Main").firsttime == "true":
	$Continue.disabled = true
	$Continue/ContinueT.bbcode_text = "[color=#646464]Continue[/color]"

I tested the actions and they work just fine, the problem is the condition on the get_node.
Please help.

Is that node in the editor? Why not this instead?

if $root/Main.firsttime == "true":

null_digital | 2019-12-16 12:28

The main node is the parent node in other scene. This doesn’t work because the main node is not at the same scene. You have to use get_node, but for some reason it doesn’t work.

Hashtop | 2019-12-16 12:56

Have you trying adding a debugger and switching to the remote inspector to see if the Main node is actually in the path you are expecting you to be. Because the get_node is obviously not finding the node.

tastyshrimp | 2019-12-16 18:14

why do you use “true” instead of true?

estebanmolca | 2019-12-17 01:24

I don’t have a actually convincing answer to this question… But i won’t use it anymore.

Hashtop | 2019-12-17 12:50