Variable Replication just stops

I’m doing an inventory system in my game and when I pick up an actor from the floor the inventory array can either have a pointer to it or if there is another item of the same type it can stack.

The function is called on the server to do the pickup, then the inventory is replicated, and the stacks of each item is replicated as well.

At some point this happens to do the stacking

 //all this runs on the server
			if (itemToPickup->GetClass() == InventoryArray[i]->GetClass())
			{
				if (itemToPickup->currentStacks + InventoryArray[i]->currentStacks <= InventoryArray[i]->maxStacks)
				{
					
					InventoryArray[i]->currentStacks += itemToPickup->currentStacks;
					itemToPickup->Destroy();
					return false;
				}

Since currentStacks is replicated, it should change on the client machine, as it does, until it gets to 1 to 8 (if I add 1 every time), then it randomly stops replicating and stays the same on the client machine but still goes up on the server machine. I tried to add an OnRep function to the currentStacks and when it didn’t go up the function wasn’t called as well, confirming it didn’t replicate. bReplicated for the item is enabled as well. Any help?

Well, that didn’t take long. I found it stops happening when I turn on always relevant for every item. It still shouldn’t happen though, any ideas why it does? I can’t use always relevant for all the items on the map :frowning:

EDIT: Okay, I think I found how to fix this. When I pick up the item that is the main one with the currentStacks I have to set the controller that picked it up as its owner, then it works just fine. Gonna keep this here for anyone else that will have this problem.