Cast variable doesnt work for multiple players

Hello,
I made a system that allow the player to choose a weapon on a hud before starting the game but i have a probleme:
First, The character have a child actor attached to it.
image
Then, in a hud the player can choose the weapon he wants before entering the game.
I made a weapon class which have multiple variable and on begin play, that weapon Cast to the player all its variable to the player’s one


each weapon have their own stats, when a player is loaded, it load the weapon with it and the beginplay resolves. which fills the variables of the player.
It works fine for a single player, the server but for the clients, the variables are empty…
Can someone help me? thanks.

it isn’t that casting it doesn’t work in multiplayer, but rather that BeginPlay() is ClientAuthority, NoReplicate meaning that anything that happens in BeginPlay() unless it effects a replicated variable only happens on the client that “owns” the actor

to “fix” this you would need to either have this BeginPlay() call a replicated function to perform this action, and/or mark the most important variables that are set in this BeginPlay() chain as replicated. particularly the one saying which weapon is equipped, and maybe how much ammo it has remaining.
outside of C++ defined variables there is a tickbox in the details panel for the variable to make it replicated. For making a function replicate that I don’t remember off hand.