The global variable doesn't work

Good morning,
i was trying to make a global variable,
this is my code and i made it autorun

how should i fix it? i have tried deleted the global.gd in autorun and add it again, but nothing works

but when i call it in gr.gd, it returns “nil”

add extends Node on your global.gd

thanks so much, it really works :blush:

No problem, reason why it works because autoloading a script is basically adding child of that script node to the root when the game first started, so it needs that “Node” to be able to add child to your root system.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.