How do I get a variable from another node's script.

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

Ok, so I am making a very simple game, and I am trying to get a boolean, show_fps, from another scene’s script. I can get to the scene that has the variable I need through $HUD/Settings. I have no idea if I can use this to get the variable, or if I can, how to do so. I would greatly appreciate if anyone could help! Thank you! (Let me know if you need more information about what I am trying to do.)

:bust_in_silhouette: Reply From: ne_mene

You can easily get the value by writing a dot and then the name of the variable, this is a common way in languages to retrieve variables from objects, try this:

$HUD/Settings.show_fps

… that is way to easy lol.

Artifabrian | 2023-04-07 23:21

so ive seen this a few times but can u explain what the
$hud
setting.show_fps
are?

so like is the hud the node name? and setting something else or am i just entirly off the mark?