Help with finding nodes

Godot Version

Godot 4.2.1.stable

Question


The hell you mean get_tree() has a null value?
As you can see in the screenshots, I’m just trying to make the ASP play a jumpscare if the player falls outta the map.

Guys can you please help me solve this? This is not the first time I’ve encountered this. Godot just sometimes can’t find nodes for some reason. I’m sure I’m doing something wrong or by tiny chance Godot is just bad at doing some stuff.

Any help would be greatly appreciated.

get_tree().get_current_scene().get_node(“AudioStreamPlayer”). Try to use this code.

You’re missing an onready annotation on the variable. Right now it’s trying to grab the audio stream player when the script is first created, which is not in the scene at that time. That’s why get_tree() returns null.

now this thing pops up

just do ASP.play()