# cant spawn online multiplayer chosen character to game

**URL:** <https://forums.unrealengine.com/t/cant-spawn-online-multiplayer-chosen-character-to-game/2243273>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, editor, CPP, question, Blueprint\
**Created:** [December 26, 2024, 8:02am UTC](https://forums.unrealengine.com/t/cant-spawn-online-multiplayer-chosen-character-to-game/2243273 "2024-12-26T08:02:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samael\_Salivan1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samael\_Salivan1](https://forums.unrealengine.com/u/Samael_Salivan1)\
**Post date:** [December 26, 2024, 8:02am UTC](https://forums.unrealengine.com/t/cant-spawn-online-multiplayer-chosen-character-to-game/2243273/1 "2024-12-26T08:02:37Z")

</div>

hello i have three stage in my online multiplayer . menu-\>lobby-\>game. in menu, player choses character and hosting or joining. then they travel to lobby. in lobby everything is correct but after this when they travel to game there are just cameras in wrong location and I cant control it.

 ![screenshot1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/0/d/80d602318685af1ebd94ab6c8467925106962353.png)  
 ![screenshot2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/a/a8a0d86a01ca876acb24e057cf56ab1cbd90eecc.png)  
 ![screenshot3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/6/1/561ae8d4fc44bf82030fd5daa003f276a5a50736.png)

---

<div class="post-metadata">

**Author:** ![Samael\_Salivan1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samael\_Salivan1](https://forums.unrealengine.com/u/Samael_Salivan1)\
**Post date:** [December 26, 2024, 8:07am UTC](https://forums.unrealengine.com/t/cant-spawn-online-multiplayer-chosen-character-to-game/2243273/2 "2024-12-26T08:07:10Z")

</div>

```auto
#include "LobbyMyGameMode.h"
#include "GameFramework/GameStateBase.h"
#include "TimerManager.h"

void ALobbyMyGameMode::PostLogin(APlayerController* NewPlayer)
{
    Super::PostLogin(NewPlayer);

    // Count the number of players currently connected to the server
    int32 NumberOfPlayers = GameState.Get()->PlayerArray.Num();

    // Log the total number of players for debugging purposes
    UE_LOG(LogTemp, Warning, TEXT("Player joined. Total Players: %d"), NumberOfPlayers);

    // If the required number of players is connected (e.g., 2)
    if (NumberOfPlayers == 4)
    {
        // Start a 5-second timer before initiating seamless travel
        GetWorldTimerManager().SetTimer(
            SeamlessTravelTimerHandle, // Timer handle
            this, // Object owning the timer
            &ALobbyMyGameMode::StartSeamlessTravel, // Function to call after the timer
            5.0f, // Timer duration in seconds
            false // Do not loop the timer
        );

        // Log the start of the timer
        UE_LOG(LogTemp, Warning, TEXT("Starting 5-second timer for seamless travel."));
    }
    else
    {
        // Log if waiting for more players
        UE_LOG(LogTemp, Warning, TEXT("Waiting for more players to join..."));
    }
}

void ALobbyMyGameMode::StartSeamlessTravel()
{
    UWorld* World = GetWorld();
    if (World)
    {
        // Enable seamless travel to avoid resetting game state between levels
        bUseSeamlessTravel = true;

        // Log the transition to the new map
        UE_LOG(LogTemp, Warning, TEXT("Starting seamless travel to game map..."));

        // Initiate server travel to the specified map
        World->ServerTravel(FString("/Game/Maps/PanchaMap?listen"));
    }
}

```

thats my lobbygamemodeclass lobby gamemode bp is based on this class and panchagamemode is based on Gamemode

---

<div class="post-metadata">

**Author:** ![Samael\_Salivan1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Samael\_Salivan1](https://forums.unrealengine.com/u/Samael_Salivan1)\
**Post date:** [December 29, 2024, 7:09pm UTC](https://forums.unrealengine.com/t/cant-spawn-online-multiplayer-chosen-character-to-game/2243273/3 "2024-12-29T19:09:57Z")

</div>

it was collision problem character was spawning inside mesh or smth. I just move down whole map and it works as intended

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 28, 2025, 7:10pm UTC](https://forums.unrealengine.com/t/cant-spawn-online-multiplayer-chosen-character-to-game/2243273/4 "2025-01-28T19:10:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
