I have a function in the player pawn that I want to call on each client, but only on the pawn that belongs to that client. There are two players (2 clients) and one calls a server RPC within their pawn. That server RPC calls a client RPC on each player pawn in the game state:
The script works fine until it reaches the second client RPC. Instead of the first client calling a client RPC on “BP_Match_PlayerPawn_C_0” and the second client calling a client RPC on “BP_Match_PlayerPawn_C_1,” they both call the RPC on the first client’s pawn:
Checking which elements that the for-each loop iterates through reveals that it actually is calling Client_AttackLocal with “BP_Match_PlayerPawn_C_1” as the target, yet it executes on “BP_Match_PlayerPawn_C_1.”
It’s working correctly and it’s executing on different pawns and not the same one. The reason being that on client _0 is always the autonomus proxy, i.e., the pawn of the owning connection. So, for each client _0 is his pawn and _1 is the other guy, i.e, simulated proxy. On server it’s correspondent to their editor index. Client 1 on server is _0 and client 2 is _1.
add input pawn reference to your server event node at beginning and pass the pawn data that sent it with it, take the output from that will now be on your server event and pass that as the target pawn you want to have info from, it will know with pawn it came from. or at least it should. Also as the guy says above, clients will always see themselves as Player controller 0 Then server is the one that knows the difference. So relying on clients to have correct info is not the play, You want the server to tell the Clients what’s up. ((((Your client is giving a print string to “self” reference he’s gonna be wrong.))))))))