Hi! I’m working on my own game in Godot but I have a problem with the script because I don’t know how to make it so that if I click a button I go to another scene. I’m asking here because even the tutorials and documentation don’t help.
func _ready():
var start_button = $StartButton
if start_button:
start_button.connect(“pressed”, Callable(self, “_on_StartButton_pressed”))
else:
print(“StartButton not found!”)
@KubusHelper Use get tree and then either the change scene to file or change scene to packed functions. You need to have a reference to a packed scene or file path, so you could use an export var of type packed scene to supply it.
BTW, the methods this other person was talking about are get_tree() to get the scene tree, and either change_scene_to_file or change_scene_to_packed to change the scene, depending on what’s convenient for you.
Hi there, if you found a solution, please post it! That way other people can benefit from the knowledge too. Be sure to mark your own answer as the solution once you posted it, that way other people will see that the question does not need answers anymore.