Have widget get variable from gamemode blueprint on clients?

You would need to replicate the variable that you want to be shared throughout the network.
Did you set it to replicating?

Hi there. I’m trying to have my widget get two integer variables that represent the score of the two teams in the match, then convert them into text and bind it to a UI text component. I’ve tried using GetAllActorsOfClass with the gamemode blueprint selected, connect it up to foreachloop then get the variables from there. It only worked on the host though, not on clients. On clients the value was null so the text was not even visible. I also tried using CastToGamemodeBlueprint but I get the same problem. Can anyone give me an idea of how to do this with replication to all clients. Thanks in advance.

Yes I did.

Okay so the final answer to you I guess…
You’ve set it to replicating that’s good.
But you also have to remember, the communication is always server → client
not client → client.
Therefore when you update a value, you have to do an RPC call to the server and ask the server to update the value, and then it’ll be replicated to the other clients.

So create an event with “Run as server” and reliable in your case I guess and update the variable whenever necessary.

I found this image on google, hope it helps.

Awesome it works now. Thanks a bunch :smiley: