How to properly set variable in gamestate?

ive come across the following problem:
i have a array of a struct holding also the players names in gamestate. to change the name a client can call a event, that is run on the server. this changes the array element for the name.
but i can only run it from the listen server. the client does nothing :frowning:

What is the problem exactly? If you need the client to be able to set the variable without running anything on the server, then that is impossible. With the way replication works in Unreal Engine, only the server can modify variables and have them be replicated to other players. Basically, if a client needs to do something that impacts other clients, you’ll need to run code on the server using an event.

If that is not your problem, then my bad.

the reason for that was that i tried to call that from an ui widget. those are owned by the client. i now call an event in the playerontroller which then changes the name. and it works.

that was indeed my problem but i could solve it by calling the server event from the playercontroller. not from the widget. (it still comes from the widget, but goes to playercontroller first)

Oh, yeah, I’ve had that problem a few times before… It takes getting used to. (It happens because the UMG widgets aren’t replicated.)