Godot Networking Question from Documentation on RPCs

Godot Version

4.2

Question

Hi,

I’m wondering about the below code from the official documentation. I don’t understand how it could print once for each client. If this script was on the server, it’s in the ready function so it would run before any clients were connected. So it would print once on the server (does rpc on the peer that called it?)

If this code was on a client, it wouldn’t run due to the conditional check.

So I’m just confused how this can run once per connected peer. And if it did, it would print once on each peer? Help! I’m confused. Thanks!

We have to assume that the multiplayer-connections where made before this script was loaded. the reason its called on the clients is, that its called with “.rpc()”, which creates a rpc-call to the other clients to call the given method

1 Like