extends Control var label: PackedScene = preload("res://scenes/ui/elements/name_label.tscn") func _ready() -> void: if Networking.playerlist_changed.connect(_on_playerlist_changed) != OK: Log.error("FAILED to connect the playerlist_changed signal to _on_playerlist_changed!", "Internal Error: Failed to connect signal.") var start_button: Button = $StartButton if start_button.pressed.connect(_on_start_button_pressed) != OK: Log.error("FAILED to connect the pressed signal to _on_start_button_pressed!", "Internal Error: Failed to connect signal.") _on_playerlist_changed() func _on_playerlist_changed() -> void: if Networking.isManager: var start_button: Button = $StartButton start_button.show() start_button.disabled = false for child: Label in $NameContainer.get_children(): child.free() for peer: String in Networking.peers: var instance: Label = label.instantiate() instance.text = peer $NameContainer.add_child(instance) func _on_start_button_pressed() -> void: Networking.start_game_call()