Why is my game scene still giving errors when the main menu is the scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Code Ripple

Hi. I am adding a main menu to my game. The thing I am doing is adding them in a scene and then changing the scene to the game scene. However, my game has errors which belong to other scenes that do not have an instance in the existing scene. I get errors such as:

Invalid get index 'HasEntered' (on base: 'null instance').

My entire project is here

I would appreciate if someone would help me.

Thanks,

:bust_in_silhouette: Reply From: Spyrex

What you are trying to do is:

  • Look at the parent node of “Hospital World” → The parent Node is “Control”
  • Get the child node of “Control” by the name “Hospital” and put it in the variable “HospitalPosition”
  • Try to get the variable “HasEntered” of the instance saved in the “HospitalPosition”-variable

Then Godot raises this error:
Invalid get index ‘HasEntered’ (on base: ‘null instance’).

This means the “HospitalPosition”-variable contains a “null instance” because there could not be found a node with the name “Hospital”.

When I look into your scene tree, I also can’t find a node named Hospital as a parent of “Control”. So instancing this scene in the editor or by code should fix this issue.

Btw. never ever use space characters in node, file, or dictionary names!