I have this code:
await get_tree().get_current_scene().name == "Lobby"
My Lobby.tscn looks like this:
and the script attached to the Lobby (root) node is:
print("Adding " + str(id) + " to the lobby")
The error says:
"Invalid call. Nonexistent function 'addplayerto_lobby’ in base ‘Control ()'.
And I'm not sure what is going on. It seems to me that I am in fact changing to the lobby scene otherwise the await would not pass, as the error is triggered by the "addplayerto_lobby" line of code. But somehow I'm not able to fetch the script, only the node? If it helps, the lobby script is a normal script and the one I mention above is a singleton (autoload and global variable)