Compare a replicated variable from 2 clients on the server

I have a replicated variable that is set by multiple clients (2 in this case). Once the variables are set for both clients, I want to compare them on the server to find out which is smaller. How can I get the value of both replicated values on the server in order to compare them? Is there some way to access all instances of a replicated variable for all the currently connected clients?

Hi I have the same problem did you find how to do it ? :smiley:

This was when I had the misconception that a variable has multiple instances for each client, but that’s not the case, you have to create separate variables for each client; ex: ammo count for each player’s gun would be separate variables stored in array and linked to each character client. AFAIK.

Thank you for your fast reply, how to link the array to each client ?

what i try to do is to compare 4 scores to see wich one is in first place, wich one in second place…
the variable that I try to compare is “score” and is in the player controller.
How to get the same variable from the controller of evrybody to compare them ?

Sorry for my bad english i m french :smiley:

Je parle un peu de francais xD

You’ll need to basically make array of length 4, for all 4 scores. Actually it’s better to do a map. You can do a map with each Player Controller, or Character, as the key, and then an int as the value. That way when you create a new character say when someone joins the server, you add an entry to that map for the score.

Another way you could do it is to make a new blueprint based off of character and use that instead, and add a score variable to it. That way, when you create a character, they will each have their own score variable that you can compare. Either way would work.

Awesome ! Thank you for your answer, I try both of them now !
Merci beaucoup ! :smiley: