button linked

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wertrhp

how i can (link) the button with something like score when i press it or point or anything like that and what the tools i need to do that and the script’s

what there different in this case in 2D and 3D

and thank you

:bust_in_silhouette: Reply From: DavidPeterWorks

You need a Score node with a script. You button pressed event signal should be sent to you score node/script.

You can use signals of button. Name of signal is Pressed.
Signals is the general way to connect things.

The method is same for 2D and 3D.

:bust_in_silhouette: Reply From: Stalf

I am not sure to understand what you are trying to do, but I know you can use the signals in your button node to check when it’s pressed. Then in your function you can hide/show your score, add points or whatever you want to do.

This video might help you.

For example on how to write the simpliest code for a button, I have this on an “exit game” type of button :

extends Button

func _on_But_Exit_pressed():