Hide text in another scene

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

Hi,
I want to hide text after pressing the button. Problem is that the text is in another scene. Could you help me please? Thank you.

Bit tricky to answer your question without seeing some code, could you share what you have tried so far? Are both the Text scene and the Button scene inside the same parent scene?

dacess123 | 2022-08-22 20:45

I tried this code:

extends Node

Skrýt/zobrazit systémové hodiny

func _on_Zobrazit_hodiny_tlacitko_pressed():
var node = get_node(“res://Uvod.tscn/Systemove_hodiny_text”)
node.hide()
pass

This error was displayed during the test.
E 0:00:42.070 get_node: (Node not found: “res://Uvod.tscn/Systemove_hodiny_text” (relative to “/root/Control”).)
<Chyba C++> Method failed. Returning: nullptr
<Zdroj C++> scene/main/node.cpp:1465 @ get_node()
<Trasování zásobníku>Funkce_mistnost_Nastaveni.gd:5 @ _on_Zobrazit_hodiny_tlacitko_pressed()

Dolpi | 2022-09-03 13:24

:bust_in_silhouette: Reply From: RuKeN

You should add a script to that text to get hidden when that button gets pressed

Here is an explanation about signals and how to detect a button pressed:
https://forum.godotengine.org/63537/button-press-detection?show=63538#a63538