Reload function works in single player, but not multiplayer for the server or client

Hi Everyone,

I have this major bug and I have no idea why my function won’t work in multiplayer.

I have a basic reload function for my top down game which: Player presses R > function checks how much ammo is needed > compares it to the ammo on the player > fills the “gun ammo” variable with the difference > plays sound >Continue shooting.

This works when I test the standalone game with just one player, however, as soon as I have a second player in the level, the reload function does not work as intended anymore, for both the client and the server.

What happens when there is another player is as follows:

Player presses R > function goes through all the checks > blueprint goes through the “set gun ammo to 30” node > plays the sound… but then in game, there is no ammo in the gun, despite having ammo in the inventory.

I have tried to replicate the function and the variables but it doesn’t seem to help.

I feel like I am missing something very simple here, but I have no idea what.

The blueprint in question is a weapon that is assigned to the player blueprint.

I know it’s messy and spaghetti-like… I’m sorry I’m still learning.

Hi Replicated Variables should only be changed by the Server since your using multicast the value of the variables are the issues most likely.

I’m okayish with multiplayer make sure to check the Network compendium by eXi.

Hi Ikav,

Thanks again for your answer.

The problem is still there. Such a weird result. I wonder if it has to do with the blueprint being stored separately on the weapon and not the player’s character?

is the weapon actor BP? if so make sure the BP is replicated (default settings).

Hi again Ikav,

Yes, the weapon is 100% replicated