indy
September 11, 2024, 12:53pm
1
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
KingGD
September 11, 2024, 12:56pm
2
It means the “GunLocation” is null, not exist.
1 Like
indy
September 11, 2024, 12:58pm
3
well idk i think it does though since I can print the position of GunLocation but cant set the position to it
Tizio
September 11, 2024, 1:01pm
4
Where do you print it? Can you show the code?
1 Like
KingGD
September 11, 2024, 1:01pm
5
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
indy
September 12, 2024, 7:29am
7
i could print get_child(2) and it seemed to work but for some reason i get the error when i use position
indy
September 12, 2024, 7:32am
8
for some unknown reason this fixed it, it could of been fixed by restarting godot but im not sure
system
Closed
October 12, 2024, 7:33am
9
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.