Worked without even using HasAuthority() in Client

void AMovingPlatform::BeginPlay()
{
Super::BeginPlay();

SetReplicates(true);
SetReplicateMovement(true);

}

1 Like

I think it has to do with version of unreal, but i’m not a 100%.

Unreal 4.25.1. bypassed the HasAuthority() if statement around the box so that now client and server both see the box moving. No error generated.

1 Like

Check the definition of the SetReplicates by selecting it and pressing F12 (visual studio), you see

void AActor::SetReplicates(bool bInReplicates)
{ 
if (GetLocalRole() == ROLE_Authority)

which is equivalent to the definition of HasAuthority function:

FORCEINLINE_DEBUGGABLE bool AActor::HasAuthority() const
{
	return (GetLocalRole() == ROLE_Authority);
}

So the authority check before SetReplicates(true); seems redundant and the SetReplicateMovement function doesn’t even seem to do a check on authority all it does is call another function to set the bool bReplicateMovement.

Privacy & Terms