Only Server Spawns As Selected Character

Hello. I am very confused after following this tutorial and I’m not sure what I’m doing wrong. . . Despite following all of the instructions in the video nearly perfectly (Had to make a few changes because my project is different in that I’m not using the ThirdPersonCharacter), I am having an issue with getting the clients to actually spawn in as their selected character. The server can do this just fine, but, anyone who joins as a client is given the default pawn character.

Tutorial Mentioned: Unreal Engine 4 Tutorial - Online Sessions Part 8: Choose Characters - YouTube

Hi, what you are missing in your code, is to tell the server the character class of the client. What you could do, is in EventBeginPlay of the player controller in your game, do a is local controller check, then get the character class from the GameInstance and pass that to the server via a RunOnServer event.

Like this (untested)

And by the way, GameInstance does not replicate, it only exists locally. So you replicated variables (like the Character class you have there) there won’t replicate.

Okay, I think I get that. . . I’m not too experienced with coding, which is why I chose Unreal for this project in the first place, so this help is really appreciated. I put in what you put into my main player controller blueprint and nothing seems to be different. . . I’m assuming this is because I’m supposed to route the character class variable thing somewhere else or hook up the RequestSpawnCharacter event somewhere though.

P.S. I figured that out about the GI. I just was turning on replication on random things yesterday out of desperation to get this to finally work.

or hook up the RequestSpawnCharacter event somewhere though.

Yes, there you should spawn the character using the CharacterClass as class.

There you then also need to specify as location where you want to spawn it, that above will spawn it at a random player start.

Oh my gosh, thank you so much! I’m so glad this works now! I was so lost before you came and helped out, searching across countless pages just for the slightest hint of what was wrong. Thank you again for the clear and concise explanation! Have a wonderful day!