Server RPC call to all Player States not updating on clients

From a replicated actor, on overlap with a pawn I am making a server call to run through all player states and make an interface call to increase player score of all players by one.

The interface call appears to only be running for the server, how can I make sure this call runs on the client as well?


playerstate

I see two issues here.

First, you say you are using a Server call from a replicated actor. An actor which is in the level I assume? Server calls only work when called from the client who “owns” the actor (ie. actor spawned with Owner = player state or controller or character, or used SetOwner on authority side). Generally, level actors do not have any Owner so server calls do not work on them, and giving them an Owner at runtime is rarely a good option.

Fortunately, you don’t need any Server call here. The overlap events trigger on both server (authority) and clients sides. All you need to do is filter out the clients, so the code runs only on authority side (use HasAuthority node).

Second problem is, your function AddScore updates the score AND notifies the HUD in the same place. This is not viable, as score updates should be done on server but HUD only exists on clients. You need to make your Score variable replicate, and you can use RepNotify to update HUD on client side whenever they receive updates.

1 Like

Brilliant! Thanks so much. Here is what I did on your advice and it works now!