Main Menu Not Switching Scenes

Godot Version

4.5

Question

I made a new 2d scene and put in both a control node with a button as a child to it. I want to be able to make a main menu (Start, new game, options etc.,) but whenever i even try to put in a ‘play’ button, it doesn’t work.

extends Button


func on_button_pressed():
	get_tree().change_scene_to_file("res://House.tscn")
	$Camera3D.make_current()

Is it a problem in my code?

Do you get any errors? Are you sure your function is connected? Usually if connecting through the editor a function will be generated with a leading underscore _on_button_pressed that is missing.

No, im not getting any errors

How do i make sure my function is connected? (im really new to godot, im sorry :,D )

When connected the node will show a signal symbol similar to :wireless:, the in-editor script editor will show a green arrow next to the function.

I connected it to the control node (thanks for the tip :D)(I cant seem to connect it to the House since its a different scene), and now its reponding but its saying in the debugger:

E 0:00:01:314 control.gd:5 @ _on_pressed(): Cannot open file ‘res://House.tscn’.
E 0:00:01:314 control.gd:5 @ _on_pressed(): Failed loading resource: res://House.tscn.

but i added a print (“pressed”) and it is reacting to that

Seems like you do not have a House.tscn in your project’s filesystem then, or it is a malformed/broken file

Oh, I spelt it wrong :,D

Thank you so much!!