Buttons won't work properly

Godot Version 4.2.2

I am new to coding so please bear with me. I have two buttons on a scene and no matter which one I press it starts the same code. I have two different codes for each button

extends Button

Called when the node enters the scene tree for the first time.

func _input(Exitbutton):
if Exitbutton.is_action_pressed(“Leftmouse”):
get_tree().quit()
else:
pass
and the other button is
extends Button

Called when the node enters the scene tree for the first time.

func _input(event):
if event.is_action_pressed(“Leftmouse”):
get_tree().change_scene_to_file(“res://charactercustomizer.tscn”)

Why do you have ‘extend button’? Did you make a button script for each button?
I would suggest doing this:

func _exit_button_pressed():
get_tree().quit()

Other button:

func _start_button_presed():
get_tree().change_scene_to_file(“your_file.tscn”)

I really don’t know about that ‘extends button’ part, but this is the way I would do that. This code should be implemented in the scene with the 2 buttons

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.