#Can I check if a Global Script has a variable and then setting it so something?

13 messages · Page 1 of 1 (latest)

red dock
#

I'm making a system where I have to find a variable in a Global Script then set it to something, but that variable changes for different instances of the object. I use an export variable and what I tried is:
value in Global-Script = true
but it didn't work. Is there an a way to do this in godot 4?

spare crypt
#

You need to use two equals for comparison

#

==

#

= is for assignment

red dock
#

but I want to assign something to the variable in the Global Script

#

is there a way to do that?

spare crypt
#

Maybe this?

if finishValue in GPS:
  finishValue = true
#

But if it's a global script.. How does the variable change?

#

I'm not quite understanding what you're doing here, I guess

#

Oh, if finishValue is a string with the name of the variable you want to change

#

Then yes, you can do this

#

GPS.set(finishValue, true)

red dock
#

thank you