Question about "Run on Server"

Hello, maybe this is a really stupid question…
When a Run on Server event is placed, anything that is related to that specific event will be compiled when a dedicated server is created and is not available on the client side, right?
also when Switch Has Authority node is used, anything that is related to “Remote” is present only on the dedicated server and not on the client, is this correct?

Also Switch has authority must be placed inside the Run on Server event or when a client need something from the server?


A server (whether it be a Dedicated or a Listen server) is automatically there by default when you start the game, it is not an object or an actor, it is your computer or the computer-server hosting a multiplayer game.
When you say than an event is run on server, it means that whoever calls the event will try to reach the server and tell him to trigger the event in his realm.

SwitchHasAuthority returns “Authority” on the realm owning the actor you’re calling it on and “Remote” on all other realms.

No, SwitchHasAuthority has to be called when you want to make sure only certain realms execute certain chunks of code.

Imagine the node you’re building are executed on every computer running your game (every realm). Each Realm has a different name: Server, Client1, Client2 etc.

Each Realm can “own” an actor, which means this realm will be the Authority on this actor if you call “SwitchHasAuthority”.

Only the server can tell other Realms what’s going on in the game (Multicast Event).
The clients can call the server to communicate information with him (and only him) using “RunOnServer” events called from Actors that are owned by the Clients (PlayerCharacter and PlayerController by default).

If you want more details, quote me with my name (it will generate a notification for me).

Thanks, so i need to place and run important logic on the server (run on server) and then multicast (update for all clients), replicate to owning client (only for the client that call it) or/and replicate variable to clients.

Server store and execute, clients just need to “retrieve” and visually show what server say.

So if I want to retrieve the amount of money stored somewhere in a remote server or service, I need to run it on the server (custom event - run on server), retrieve the variable and set the variable to replicate, so from the widget or just elsewhere I just need to show the retrieved variable retrieved from the server.

is correct?

If the value is replicated and the HUD supposed to display the value has access to that value, you don’t have to run any event, you can just read the value.

If you need to modify the value though, you’ll need to ask the server to do so. In that case you’ll call a RunOnServer event.