Can someone quickly help me with a weird error

4.3

Hey so I have this error with my code “Invalid access to property or key ‘position’ on a base object of type ‘null instance’.” and I would appreciate help.

error occurs upon collision with player.
script is also on the AK47 as seen in scene viewer

It means the “GunLocation” is null, not exist.

well idk i think it does though since I can print the position of GunLocation but cant set the position to it

Where do you print it? Can you show the code?

Try to print body.get_children(), to make sure all is well.

You are also just comparing if held == true in line 20. You probably meant to write “held = true”

i could print get_child(2) and it seemed to work but for some reason i get the error when i use position

for some unknown reason this fixed it, it could of been fixed by restarting godot but im not sure