Invalid set index 'visible' (on base: 'null instance') with value of type 'bool'. This is le error.

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

The solution was get_node is wrong so ima post the scene with code now. I asked this but the solution they gived didn’t worked.

func _ready():
$Props.visible = false
$EButton.visible = false

My scene :

Player(KinematikBody2D)

PlayerSprite
Props
EButton
CollusionShape2D
Area2D

CollusionShape2D

:bust_in_silhouette: Reply From: Inces

Props node does not exist at the moment of players ready function

I assume this ready() function belongs to Player script ?
If Yes, than I answered correctly, this kind of error only appears when node after"$" is not a child of scene, who calls it. You have shown Your scene scheme and it looks correct, but You must ask yourself if maybe $Props is not YET child of Player at the moment of trying to change visibility, or did Props change path or name at the moment of changing visibility. You must have messed up something silly

Inces | 2021-03-21 22:05