Why doesn't it work

Godot Version

4.2

Question

After a character’s death the scene does not change to the “death screen”
Gives an error:
player.gd:68 @ _physics_process(): Parameter “body->get_space()” is null.
and
player.gd:65 @ _physics_process(): Parameter “data.tree” is null.

Code

if health <= 0:	
	health = 0 
	animation.play("death")
	await animation.animation_finished
	queue_free()
	get_tree().change_scene_to_file("res://death_screen.tscn")
	
	
move_and_slide()

That’s not enough information to figure this out, but it’s possible that calling queue_free() in a physics object after an await is causing issues.

1 Like

thx
I googled the problem you described and everything worked for me