Why do we need "run on owning client"? In the document illustration "not replicated" or "run on server" also works

In the document illustration that shows “run on owning client”, I found that I could make it work even if I change it to"not replicated" or “run on server”. So what’s the point of “run on owninng client”? Under what circumstance do we need it?

document: Replicating Functions in Blueprints | Unreal Engine Documentation

The third part(near the bottom) is an example using “run on owning client” to simulate inventory empty/ get item:

https://docs.unrealengine.com/latest/images/Gameplay/HowTo/Networking/ReplicateFunction/Blueprints/HowTo19.jpg

After I change it to “not replicated” or “run on server”, it still works:

1 Like

Run on owning client functionality depends on who executes it.

Look at this chart from the RPCs documentation on the Client column

[RPCs][1]

So first we can see that Run on owning client pretty much only matters when you call it inside the server, because if you call it from a client it only affects himself which isn’t different from any regular function.

Now, when you call it from the server, Run on owning client behavior depends on wether you are calling it for a Client-owned actor or a server-owned actor. The only client-owned actors are usually players controllers and their pawns. In this case you are executing the Add item inside (I’m assuming) the trigger box blueprint, which is a server-owned actor that is why you don’t see a difference.

You would use run on owning client, for example to tell the client version of a player to set some variable that isn’t replicated by default, like walking speed. Or maybe you would use it to execute a certain effect or sound that you want to happen only in one client.

Edit: I hope my answer helps! Tell me if you have any more questions!!

8 Likes

It’s so perfect an answer! Thank you so much for getting me clear about this stuff!