# Because the game is in the middle of managing the physics frame, so you can't suddenly delete all the physics objects its trying to manage. Just call it deferred: get_tree().change_scene_to_file.call_deferred("res://scenes/main_menu.tscn")