Checking variable from another object

Root
-player
-ui
—button with script

I’m relatively new to Godot, in the tree given above, how can I check if player is_on_floor() in the script of the button?

1 Like

I believe you could have a script in the player that sets a variable when the player is on the floor, and drag the node of your player into the script and you should be able to put a dot after that and get the variable. I’m also new to Godot, so you may want to fact check this.

1 Like

Dragging nodes into scripts to instantly get the path is such good tech, also I found out I could just use

$"../player".is_on_floor()

while implementing your solution.
Thanks

1 Like

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