Signal is not being emitted, despite print confirmation

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

I was working on a simple multiplayer setup, and I just want to have it so when the server is created, it will send a signal to the LobbyMenu script which will add a new little box with the username in it.

func create_server():
var peer =
peer.create_server(SERVER_PORT, MAX_PLAYERS)
get_tree().network_peer = peer
print("Server created.")

I ran the game and the print("Server created.") ran, but apparently not the single because…
func _ready():
    Network.connect("server_created", self, "_server_created")
    Network.connect("player_joined", self, "_player_joined")
    Network.connect("update_client_player_list", self, "_update_client_player_list")
func _server_created(local_username):
    print("Server Created, Updating LobbyMenu")

The “Network” is an autoloaded singleton of the Networking script with the create_server() function. That print message in _server_created never shows up.
I guess I’m asking if I’m making some dumb syntax mistake, or if anyone has any ideas as to why its just…not going.

:bust_in_silhouette: Reply From: sash-rc

Use debugger with breakpoints, or add diagnostic print near LobbyMenu._ready, to see what actually happens (in which order).
Just a guess: it could be that LobbyMenu is not ready (and thus not connected to signals yet) at the moment you emit a signal.

Normally “dumb syntax mistake” won’t allow to run a program. Runtime errors are shown in logs.