Swich has authority and replicated variables

I’m not sure that I know how the switch has authority works. When I run my game with 3 players, health is set for all of them, but I thought if I use switch has the authority it’s gonna be set only for server.


But when I use replicated variable without switch has authority it seems like its set 3 times for each of them


Can someone explain to me how it works?

I guess you call that in something like a pawn? In your first what happens is, your server has 3 pawns, his own and the two client pawns. for every pawn he has he sets the health of that specific pawn instance and prints the string. this is why you see “server: …”
your second node runs on server and client (because of not checking authority). So server has 3 Pawns => 3 Printstrings, Client1 has his pawn + 2 simulated pawns, CLient2 also. So the BP Function runs on EVERY Pawn Instance, no matter if client or server, BUT the SetVariables on your Server dictate the value on the client! Meaning, you can set healt to 100 on client, and 10 on server, when your variable is replicated server wins => client gets 10 health.
What you’re looking for is a combination of both - use Authoritiy, and then set your replicated variable value. You can have a look on the clients by hooking a “printString(Health)” into the client Tick (with delay of 0 and Print to Log NOT checked) - which should show you the server dictaded value on the client.