Main Menu Scripts Not Loading

Godot Version

v4.6.1.stable.official [14d19694e]

Question

My game has a ‘pause menu’. One of the buttons in these menus is connected to this function:

const menuScn:PackedScene = preload(“res://menu.tscn”)
func on_savequit_button_pressed():
    ...
    currentScene.queue_free()
    currentScene = menuScn.instantiate()
    get_tree().root.add_child(currentScene)

The menu loads, but none of the buttons on the main menu work. According to my debugging with print() in the _ready() function of the script attached to the menu, _ready() isn’t run by the menu either.

You need to set the buttons or the whole menu to either Always run or run When Paused.

It’s in the Inspector under Node.

I recommend you just change the root node to When Paused and see how that goes.

In addition to what @dragonforge-dev, is there any reason you’re not using the get_tree().change_scene_to*() methods?