Play button not working after player dies

Godot Version

Godot 4.3

After a player dies in my game it goes to the main menu but when I press play it does not restart the game, it does nothing.

This is my code for the main_menu:
extends Control # Attach this script to a Control node, typically used for UI elements.

func _on_play_pressed() → void: # Function called when the “Play” button is pressed.
global_script.reset_player_stats() # Reset the player’s stats.
get_tree().change_scene_to_file(“res://scenes/dungeon_generator.tscn”) # Switch to the dungeon scene.

func _on_quit_pressed() → void: # Function called when the “Quit” button is pressed.
get_tree().quit() # Exit the game.

func _on_settings_pressed() → void: # Function called when the “Settings” button is pressed.
get_tree().change_scene_to_file(“res://scenes/settings_menu.tscn”) # Switch to the settings menu scene.

All the signals are connected properly, the quit and settings buttons work

Do you pause the game before going to the main menu?

No, when the player dies it goes to the main menu.