Insert Function Invalid Call

Godot Version

Godot 4.2.2


Hey guys,
Sorry for the bad code your about to see but I’ve been watching a tutorial by Maker Tech to make a Action RPG. I’ve got to a part where im trying to insert the items I pick up into my inventory but when I walk over the items to pick them up I get a “Invalid call. Nonexistent function ‘insert’ in base null” right now the insert func just has a pass on it to check to check that it works like in the tutorial I’m watching but obviously I’am getting this error. Any help with this would be great and again sorry for the dumb question/bad code


Hi, the collect function requires an inventory argument but that argument is not being passed. Where is the collect function being called?

1 Like

Hey there,

The collect Func is being called in the player script when I walk over an Item.

again sorry if this is dumb as Im very new to Godot.


what is the inventory variable

The inventory variable I have here is just Inventory

so it is not assigned a value. the colon is only for type assignment, you need to have an actual inventory object

how would I go about doing that. I’ve been copying the code from the tutorial I’ve been watching as I’m very new to godot and trying to learn.

i haven’t seen the tutorial, do they have anything assigned to the variable?

1 Like

From the code, it seems like you might have a node or something that is of class inventory, so if it’s a resource, you can make a new one in the inspector.

Yes your right it is a resource. But the resource was already created and theres still the error.

the pics included are the Inventory resource and the script its conncted too

Hey, in this screenshot you’re showing the script “” and referencing the variable inventory. Find the place in the 2d, graphical editor where you stuck your player and click on it. Because you have @export var inventory: Inventory there should be a line in the inspector on the right side of your editor that says “Inventory” with a value next to it. Can you screenshot that?

If there’s nothing there that’s your problem. The solution depends on the tutorial (and I don’t want to mess that up), but you could start by clicking the drop-down in that empty area next to “Inventory” and making a new Inventory resource.

1 Like

That was the solution. I didnt have the inventory added on the player. So thank you so much :pray::pray:

1 Like