Integer variable only using default value opposed to the value set.

I have a multiplayer system in which a host can set the maximum amount of players, create a session and once that number of players is present in the lobby the game begins. This functions fine apart from the Public Connections integer variable, which only uses its default value from the details panel instead of the number set in the game creation blueprint.

I can tell that the set number is being recognized via a print string, but I’m wondering if anyone could help me understand how to fix my default value issue.

This is the blueprint in which the number of players is set, with the variable’s default value at the bottom.

This is the blueprint that determines if the correct number of players is present in the session which is run on a delay after every new login. This code works fine but as mentioned only derives from the Public Connections’ default value, opposed to any set value.

Any help is really appreciated, I lose sleep over this code.

Where is this login code located, on the GameMode? Also, widgets only exist on the owning client, so they can’t use replicated variables.

(post deleted by author)

Are you testing this as a Server or Client in PIE? If you run as Standalone/Server, is the value correct? How exactly are you transitioning: Are you using OpenLevel or ServerTravel? OpenLevel will destroy and recreate the player controller upon loading the new level, thus not guaranteeing the widget survives. The game instance would likely be a better place to store this session information anyhow unless you are using ServerTravel to travel between the main menu and lobby.