Hi there,
I was looking at a piece of code that had :FireServer() in it. Then, it stumped me.
What’s the difference between :FireServer() and :FireAllClients()?
Please help in the comments!
Hi there,
I was looking at a piece of code that had :FireServer() in it. Then, it stumped me.
What’s the difference between :FireServer() and :FireAllClients()?
Please help in the comments!
:FireServer() must be ran from a client, and when listening for the remote’s event on the server, a player
argument will be passed through the event telling you who ran :FireServer(). FireAllClients must be ran on the server and will fire every client’s listening to the remote event’s OnClientEvent event.
Oh this brought up a question in my head. Does FireAllClients take the same amount of time to run some code on all clients as FireServer?
Fire server takes somewhere around 155ms to reach the server, does FireAllClients take the same amount of time?
I have no idea but you can test it via benchmarking
Network latency isn’t related to performance. If the server and the client have the same specs, both will run equally as well, with network latency for both.
Tysm!
This will really help me in the future!
FireServer() is called from local scripts exclusively in order to allow for the client to communicate and transmit data to the server, this is achieved by having a server script with an “OnServerEvent” event listener which listens for a “FireServer()” call.
FireAllClients is called from server scripts exclusively in order to allow for the server to communicate and transmit data to every individual client currently connected to the server, this is achieved by having a local script with an “OnClientEvent” event listener which listens for a “FireAllClients()” call, this is similar to the function “FireClient()” which essentially operates in the same way but requires the player instance pertaining to the client being fired to be passed as an argument to it.