Need help resolving an error/bug

Course name: Godot 4 Multiplayer: Make Your Own Online Game

Lesson #: 4.4 Opening A Door

Error: "invalid set index ‘visible’ (on base ‘null instance’) with value of type ‘bool’"

Hey everyone! My son is currently taking this course and keeps getting the following error under the set_door_properties function on line 15 door_open.visible = is_open.

A little more information from what I can gather. This is a multiplayer game and when he runs it, two windows open where you can host the game/join the game. Everything loads fine and runs as it should, until one player steps on a pressure plate (connected via signal to the door) once stepped on, the door should open, allowing the other player to enter. However, once one of the players steps on the pressure plate, the window with the hosted player freezes and the game crashes, that’s when we receive the aforementioned error.

Not sure why… His code looks exactly like the instructors and his nodes are set up in the same exact orientation.

If you need any additional information in order to help out, please let me know. Any help would be much appreciated. Thank you!

The good thing is, this is a very common error actually, and it means Godot can’t find:

  • the boolean property…
  • called visible
  • on the object [null instance], which is supposed to be door_open in this case.

The reference to door_open is broken, as Godot is showing a null instance where door_open should be. Because this reference is built using an @export variable, and because you have said the code and scene trees appear to be identical, most likely the door_open field in the inspector hasn’t been filled with the DoorOpen Sprite2D from the scene tree (it can also be that it was filled initially and has since been cleared, which will happen if you adjust the @export variable’s declaration, such as renaming it. I’m betting something like this is what happened).

Fixing it should be as simple as dragging the DoorOpen Sprite2D back into the door_open Inspector field. Hopefully that fixes it, as I would need some screenshots etc if it doesn’t =)

Privacy & Terms