I want to connect a Signal and a Node, but it is already connected?

Godot Version



So basically the titel:
I have a VBoxContainer and as soon it gets visible (just a solution on time, will change it later) I attach for every “beschwerden” in resource “tag” one Anfragen_Label which is a TextureButton Node with a Label Node.
And I make the Text of the Label Node in the Anfragen_Label to the Label_Text in t.

  • To this point everything (what I can overlook) works great.
func _on_anfragen_liste_visibility_changed():
	var anfragen_Label_standard = load("res://Anfragen_Label.tscn")
	for t in tag.beschwerden:
		var anfragen_Label_instanz = anfragen_Label_standard.instantiate()
		anfragen_Label_instanz.find_child("Label").text = t.label_Text

When I emit the signal the following is called:

func _on_this_are_the_buttons():
	var alle_Kinder: Array = raster_Anfragen.get_children()
	for i in alle_Kinder:

I collect all children of the BoxContainer in an array and then I want to connect all the listed children in the array with “_on_open” and “zähler” (I initiated the last one earlier in the code)
Here I get an error they are already connected.

In the func _on_open() I want to give another TextLabel (which I open when I press on of the Anfragen_Label) a specific text (a different text for every button).
I thought it would come in handy, if the text would be transmitted in “zähler”. Because the text itself is stored in “tag.beschwerde_Text”. I tried something mathematical but failed, would be incredible if someone had an idea to help me.

1 Like

this function is called multiple times, hence the error said the buttons already connected to the _on_open function

so to make sure the signal isnt trying to connect twice to the same callable which is the _on_open
you do this:

func _on_this_are_the_buttons():
	var alle_Kinder: Array = raster_Anfragen.get_children()
	for i in alle_Kinder:
		if not i.pressed.is_connected(_on_open):