Help with script (hiding)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ShaneGrey413
:warning: Old Version Published before Godot 3 was released.

Hey everyone I am trying to script this thing that when a button is pressed it will hide the wings from another node. Both nodes are linked to the same main scene but I want the button when clicked to hide a specific sprite in the world. Sorta like an equip/unequip button.That’s the right path by the way if that helps. Also when I get the path then do hide() it hides the entire GUI and not the item. How do I make it so it only hides the item and unhides it when the button is clicked again?

Here’s my script:

extends Panel

func _ready():
	set_fixed_process(true)
	
func _on_MenuButton_button_down():
	get_node("Player/Shane's-Wings")
	hide()
:bust_in_silhouette: Reply From: YeOldeDM

When you call hide() you are doing the same as if you were to call self.hide(), which will hide the node this script is on. All you need is to call hide() on the node you’re getting on the line above.
get_node("Player/Shane's-Wings").hide()

I did that earlier but I tried it again and i’m getting this error:

Attempt to call function 'hide' in base 'null instance' on a null instance.

ShaneGrey413 | 2017-05-08 03:44