How do I fully control the parent node with a script attached to the child node?

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

How do I fully control the parent node with a script attached to the child node? Like how do I get the parent node to run code that is in a script attached to the child node, as if the code belonged to a script attached to the parent node( even though that’s not the chase)?

It’s hard to say based on the limited info provided above, but I’d guess there are likely much better ways to solve whatever issue you’re working on. Perhaps with some more details about what you’re really trying to solve here, someone can offer a better solution.

jgodfrey | 2023-01-02 18:01

I’m trying to make a state machine with a node hierarchy.

AudioBellum | 2023-01-02 19:59

:bust_in_silhouette: Reply From: SQBX

You can use get_parent() to call functions and get variables from the parent node

print(get_parent().name) # Prints the parent's name

print(get_parent().rotation) # Print's the parent's rotation

get_parent().scale.x = 2.0 # Sets the parent's scale's x coordinate to 2.0