label node wont turn invisible

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

extends Label

func _ready():
if Input.is_action_presed(“ui_enter”):
self.visible = fasle

why isn’t it vanishing?

also, attach simple scripts like these to the main node in your scene. It’s a lot easier to handle.

umma | 2022-01-12 23:46

:bust_in_silhouette: Reply From: Gil-Koren

the ready function runs only once, when the node enters the tree.
I’d suggest you use the _input() function like this:

func _input(event):
    if event.is_action_pressed("ui_enter"):
        self.visible = false