Clients are disconnecting during Server Travel

Hi, I have had this issue for more than 2 years now and I can’t seem to fix it. It all works fine in editor but when testing with 2 different machines and steam accounts it breaks.

Overview of issue:

The issue is when I package my game to test with a friend I can Invite my friend and he receive the invite and sometimes I can join the lobby if both players have the same version of the game. Once we in lobby everything works fine we can then start up a custom game and load into character select using server travel with no issues other than client is bit slow but client always connects and transitions to the new map and UI everything works. Another issue is here its a small one but for some reason the client when spawning the preview characters its bugs out and always spawns them -180 instead of 180 for the clients but only server always spawns correctly anyway first I want to fix the client disconnecting issue. After we select our characters this is where the problem begins the server spawns like normal but client is lost and uses default camera and disconnects. This is what I want to solve as I am using the same way I server travel from lobby to character select map but why is it when I do from character select map to the game map it breaks?

Walk Through Of Code (Not Fully):

First we are at the main menu:

Then once you press “Login” The loading bar appears and text hides. Here the code for the UI in widget:

The “ClientHostSession” is in the MainMenu_PlayerController and it is a custom event that is executed on the owning client. The “Server Info” is an object reference.

Then “Host Session” is in the ServerInfo (Game Instance)

Once We are in Lobby:

We can invite my test account on my PC. (Laptop is player 1 and PC is Player 2) I’m lazy so I am using remote software to control my PC ignore the steam notification.

Client get joining party pop up.

As you can see client has joined the server from invite no problems so far.

Both Server and Client have gotten the custom games widget and are in there teams. Only Server has the “Start Game” button. Once pressed this code is executed in the Widget:

The “Travel To” is a game mode of the Character Select Game Mode and here is the code:

Now Server executes this and this one always works the lobby to character select map. The First screen shot is the Client when loading its like this but then after few seconds it works properly as seen in image 2.

After Server and Client have selected there characters I have a system that every time a player presses the “Lock In“ button it runs this block of code in the widget:

Again similar approach server runs server travel command that is in the character select game mode:

↓This is the clients POV and this what happens when server traveling again to next map ↓

Sometimes it kicks you out to the main menu after seeing the image above but sometimes it stays on the default camera. If you check out the Servers POV I’m standing near the area of the clients default camera and can’t see server no matter what or hear or anything.

Here is the Servers POV:

Spawning Of Character for the playable map:

Here I am going into detail about the spawning of character maybe something wrong here instead?

GameMode:

This is the override of the “ChoosePlayerStart” Becuase I have custom Player Start as you can see here:

Now This is how I handle New Player. First I set them a index.

Now I add the player controller to an array of new player and show them a loading screen.

Then I get some player info.

Player Controller:

The event begin play cast to an event that gets the players select team.

then we cast to game mode and feed this data to spawn the character.

Then the character is spawned and possessed.

Also if you noticed the screen shot of the “Servers POV“ part if you read the top left where the print strings are you can see server was a spectator and client was a character but even if client doesn’t make it I don’t see the characters pawn anywhere when I’m using the Server to move around the map to find client.

Please help me I want to continue working on my game in other parts of it instead of coming back and trying to fix this issue I have wasted lots of hrs trying to fix this problem could have finished my game by now if was not for this. Its just a game for me and my friends to play and would like to play with them properly. Thank you for taking the time to read this and I hope you can fix my problem :smile:.