Help with custom buttons

Godot Version

Godot 4.3

Question

I am a student working on a project, for which I want to make some custom buttons. I currently have an area 2d with a sprite2d and a collision polygon 2d. I have linked it to a script with

func _on_char_custom_button_input_event(viewport: Node, event: InputEvent, shape_idx: int) → void:
print(“button clicked”)
if event.is_pressed():
get_tree().change_scene_to_packed(load(“res://scenes/character_creation.tscn”))

Yes I understand that I should preload the scene when I load the game, but it kept breaking when I did that and I haven’t gotten around to troubleshooting yet. My problem is the function isn’t working, but only when I fully run the game, it works in the debug run. The signal is connected, pickable is set to true on the area2d and it does have a collision layer. when I asked my teacher he said that this is how he always makes custom buttons and we couldn’t figure out why it was breaking. I want the buttons to be a custom shape so I can’t use a normal button node. Any workaround or alternate way to do this would be appreciated

Does the exported build print “button clicked”? Is the export a web build?

change_scene_to_file may be more appropriate, if you can’t use preload this script may be required in the character creation scene, cause a cyclical reference.

It does not print “button clicked”

also sorry for the confusion, but I meant running f5 as playing the full project and f6 as debug run, thats my bad for using bad terminology.

Thank you for the change scene to file advice. that works great.

Ah F6 is “Run current scene” not more or less debug than F5.

Maybe you have a Global or main scene Control node blocking UI inputs

I have no control nodes in my main menu scene, and I currently only have one global script that is currently just some variables and signals.

my scene is 4 area2d buttons as described above as children of a Node2d

What type does the global script extend?

it extends Node