Why is my move_and_slide & my dash stuff having errors when the scene resets?

4.4

When the scene resets my move and slide becomes null (by the way this is the player script)

And when the sceme resets even my dash thingy has an error too

And now it gives the can_process error
!

What i used to reset the scene:
Func physics_process(delta: float) → void:
If Globalplayer.health == 0:
get_tree().reload_current_scene()

Sorry for so many questions!

It’s not a whole lot of information to go off of, so I can only make a few educated guesses.

You should check what reload_current_scene returns, as it might give you some errors you don’t know about that might help you debug the issue, see: SceneTree — Godot Engine (stable) documentation in English

As far as I can tell, you reload the scene inside the physics_process function. This might be a bad idea, as this gets called many, many times a second, so something might go wrong. Try to instead call this in the function where you lower your player’s Health points.

You could also try to set the scene manually, there’s a great section written about this in the documentation, see: Change scenes manually — Godot Engine (latest) documentation in English

1 Like

Now i get this error

Im not even removing the collision i think
Btw off topic how to reset a global variable? Like health? I want it to reset when you die but i dont know how