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.

1 Like

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?

1 Like

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

1 Like

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

2 Likes

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

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.