Hello, I want to display the number of players on both client and server, I’m using the GetNumPlayers() function in C++, and I call that function in a blueprint widget bind function. (So I want to bind that function to a widget textblock).
It gets bound correctly, and it displays the data, but the server displays the correct number of players only (for example 2, 1 listen server, 1 client), because obviously it is the server so it knows about all the players, while all of the clients display 1 as the number of players. Which is because it only knows about itself.
So how can I get the Server number of players value on all of the clients? Server RPC? Multicast? (The c++ function with the number of players is written inside the gamemode, but also tried it in the gamestate, but no luck).
How would I do that? What I have done yet, is to write a function inside gamemode that calls GetNumPlayers function, then the gamestate calls the gamemode function and the widget prints that value.
Nothing is replicated yet, I should replicate the gamestate value or the gamemode value?
This is how it looks currently, this is the bind function inside the widget, it displays the number of players, but the server shows 2 the client shows 1 (with 1 listen server and 1 client instance). The function’ return value is replicated.