Variable in GameState only being modified on Client side

Hi all,

I am trying to modify an array variable located in my custom GameState, WITHIN my custom GS blueprint, and only the client recognizes the change, not the server. I know this because I have the length of the array print on Event tick. Client prints correct amount, server prints 0. The variable is set to Replicated. I’m stumped. Any idea why?

Do you set the variable on the Client? Replication only happens from Server to Client never from Client to Server.

Make sure you Set the variable server-side.

Thank you for your reply. How could I do this?

You need to send a RPC (RunOnServer event) from an Actor that the client sending it already owns like the owned PlayerController or the possessed Pawn etc. Then when you successfully sent the RPC you can set the replicated variable by the server from there.

thanks man saved me after 8 hours , for anyone with my problem : you cant change variable of gamestate / game mode from HUD even if you set the event as RunOnServer , you have to cast from HUD to Player Controller and run on server from there . (you are client in my example if you are server it doesn’t matter)