Update a variable on server

Hello guys,
I tried for 2 days and i’m still don’t know how do that :confused:

Here’s my problem:
My game is a multiplayer, and in a level the players pick only 3 times the same ammo and only one for each player. So, if we have 3 players, each one can pick one ammo.

But here’s the problem: When one player picks the ammo, i add 1 to a integer variable who is on the GameState. But the integer only updates on the client who picks the ammo. So if the server player picks 1 ammo, and a client too, it will show on the client’s widget: 2 players got the ammo, but on the third player and on server still shows: 1 Player got the ammo.

If the server picks the ammo, and one client player picks the ammo, on client it will say: 2 players got the ammo.
But if a third player got the ammo too, it will say: 2 players got the ammo.

It seems the game don’t update the ammo integer i have on server.

241778-test1.png

I tried to create a custom Event to “Run On Server” and “Multicast” but it’ still don’t work. I’m firing this events on a Widget, there’s any problem if i do that? (Oh, don’t worry about the 0 … 2 on the Slider Range and Value Range, i was making some changes when i got the screenshot, but even if i don’t do a range or put another value as 5, i will have the same error).

Thanks a lot for the help, if you guys can help me, i will be very grateful :slight_smile:

I found what happened guys, i can’t do that on a widget. I did on the PlayerController and worked.

1 Like