Invalid call. Nonexistent function 'pick_up_item' in base 'KinematicBody2D'.

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

I know that my question probably asked couple of times but I really couldn’t figure out why it doesn’t work

##This is my attached signal in, collision triggers this properly
func _on_PickUpZone_body_entered(body):      ##body is 'Item' itself
    print(         ##prints correct item's name btw
	body.pick_up_item()       ##this line is throwing error

##This is my function inside in
func pick_up_item():
	being_picked_up = true

##Both of the scripts extends from Kinematic2D

This code should be working, Signal works properly and it prints correct item’s name but it is not calling the function pick_up_item. Returns this error:

Invalid call. Nonexistent function 'pick_up_item' in base 'KinematicBody2D'.

I have the correct object and it should call the function but it doesn’t, why??

:bust_in_silhouette: Reply From: fracment

Solved it. Item script wasn’t attached to the node.

Actually it was attached to the node but only in CurrentMapScene. Not the Its own Item Scene.