Help with pickup system

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

I am trying to make a weapon pickup system. I am doing this by testing when a weapon is in the pickup area, then adding it as a child and activating it. Everything works, except no matter what I do, it always adds the area as a child, and not it’s parent (the actual gun).
How could I fix this?

Heres the code:

func pickup():
if holding == 0 && canhold == 1:
	get_node(areas[0].get_parent()).held = 1
	get_node(areas[0].get_parent()).global_position = $holdpos.global_position
	add_child(areas[0].get_parent)
	print(get_children())
	holding = 1

What did I do wrong?

:bust_in_silhouette: Reply From: exuin

Is it because you forgot the parenthesis on the get_parent on line 5?