0 votes

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.

in Engine by (39 points)

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

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

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.

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.

why do you use "true" instead of true?

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

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.