Server RPC is being called by client, but also run on the client?

I am trying to have the client ask the server to update a variable so that it will be replicated. Currently the variable is being replicated correctly to all clients when run by a listen server. When I am performing the action that would cause the update as a client, I successfully call a server RPC. However, if I update the variable inside the server RPC (called by the client) it is not replicated. Additionally, if I query the role inside of the server RPC, it tells me that it is the client! How can I get this to run on the server, so that the variable will be properly replicated?

Here is my server function declaration:

UFUNCTION(Reliable, Server, WithValidation)
void ServerUpdateVar();

void ServerUpdateVar_Implementation();

bool ServerUpdateVar_Validate();


void ARandomActor::ServerUpdateVar_Implementation()
{

if (GetNetMode() == NM_Client)
{
	UE_LOG(TempLog, Warning, TEXT("--------------- THE CLIENT HAS INFILTRATED THE SERVER"));
}
else if (GetNetMode() == NM_ListenServer)
{
	UE_LOG(TempLog, Warning, TEXT("--------------- I AM THE SERVER"));
}

RandomVar++; // replicated variable

}

bool ARandomActor::ServerUpdateVar_Validate()
{
return true;
}

Solved this! It turns out the problem was that the client was spawning ARandomActor, and it should have been spawned by the server and then assigned ownership to the client controller. Both of those steps are necessary to make a server RPC work properly from a client actor.