how to give functionality to a button when its pressed for the second time?

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

when i press once, it opens another button, but I want to make it close them if I press it the second time

Hi,
code please?

klaas | 2020-08-18 11:29

func _on_call_pressed():
$calle.visible = true

$callj.visible = true

$panel.visible = false

$talk.visible = false

$Cancel.visible = false

$"send ".visible = false

Dream | 2020-08-18 11:33

:bust_in_silhouette: Reply From: klaas

hi,
you can toggle visibility with

func _on_call_pressed():
    button.visible = not button.visible

this negates the visiblity whenever called

thanks a lot

Dream | 2020-08-18 11:40