RPC function vs RoleAuthority check?

@eXi



void AMyCharacter::PostInitializeComponents()
{
	Super::PostInitializeComponents();

	if (Role == ROLE_Authority)
	{
		Health = 100;
		Armor = 0;
		InitializeInventory();
	}
}


The code above tells the **server **to set the initial parameters for every player in the game.

Actually, the Health and the Armor are succeffully set.

But the InitializeInventory() function happens on the server and not on the client…



void AMyCharacter::InitializeInventory()
{	
	if (Role < ROLE_Authority)
		return;

	int32 NumWeaponClasses = DefaultInventory.Num();


	for (int32 i = 0; i < NumWeaponClasses; i++)
	{
	       ...
               // Spawns the weapons in the world and adds them to the player's inventory
               ...
	}
}


At the game start, I see the weapons spawned for the Server but not for the Client.

What’s happening?