GetLocalRole returns different value depending on map

I’m using one of the FPS templates on the UE4 marketplace but I’ve added my own character class written in C++.

On one of the maps from the template, the following code inside of my character class does this:

GetLocalRole() // returns ROLE_AutonomousProxy

But when I start on a different map and server travel in game to the same map mentioned above, it does this:

GetLocalRole() // returns ROLE_Authority

I originally encountered this problem because I have a rep notify that isn’t getting called on the client on certain maps.

I have a decent understanding of replication and the like, but I’ll admit this is going completely over my head. The only thing I can imagine is the server travel is somehow changing the role on the actor my character is controlling.

Any help would be much appreciated! I’ve been stuck on this for weeks

1 Like

Hi there, I might be totally wrong, as my understanding of replication is not at all great. However, doesn’t unreal gets a random controller to be the server? When you switch maps, maybe that is why it’s happening?
Have you tried using dedicated server for testing?

I’m using “Play as Client” and that’s where this is happening. This simulates a dedicated server, right?

I thought of some things, but you probably already tried it all:
Have you tried packaging the game and see if the error persists?
(I asked, because I have some bugs with UI that only shows on my packaged game, as the server doesn’t show at all in the editor).

Are you using seamless travel?
How is the character been spawned in the new map? Is the game mode handling the spawning?

Sorry that I can’t be much more of a help, which FPS template are you using?
edit: forgot to answer about the “Play as client” - the documentation says that play as client will spawn a dedicated server, yes. " * Play As Client: Enables the Editor to act as a client. A dedicated server spawns behind the scenes to connect to."

I haven’t tried packaging it yet due to load times (my computer is as old as time itself), but that’s something I’ll try!

Yes, my game mode has seamless travel turned on and the game mode is handling the spawning of characters and the possessing of those characters via a controller. How would this affect things?

No worries. Thanks for trying to help. I’m befuddled

Hi, i dont know your exact code, but when you execute server travel on your client with ?listen at the end of the URL you are specifieing the server as a listen server, which could also result in you having the Authority Role.

You can read about it here:

As far as I know seamless travel is still disabled in single-process Play In Editor. Not entirely certain whether the dedicated server runs in the same or another process by default. See if you get errorcode 404 make sure you are logged in to GitHub and have access to the Unreal Engine source code repository.
From AGameModeBase::CanServerTravel:

	// NOTE - This is a temp check while we work on a long term fix
	// There are a few issues with seamless travel using single process PIE, so we're disabling that for now while working on a fix
	if (World->WorldType == EWorldType::PIE && bUseSeamlessTravel && !FParse::Param(FCommandLine::Get(), TEXT("MultiprocessOSS")))
		UE_LOG(LogGameMode, Warning, TEXT("CanServerTravel: Seamless travel currently NOT supported in single process PIE."));
		return false;