Whats better? :OnServerEvent or :OnClientEvent

Is OnServerEvent / FireServer Better then OnClientEvent / FireAllClients?

I need some help figuring this out! Thank you.

1 Like

They have completely different uses. One pair is for communicating information to the server, and the other for communicating to the client.

The API and related pages might explain it better.

6 Likes

Not that! Trying to reduce lag, for example in my ELS System I have this
:FireServer(“ELS”)
Etc

1 Like

As she said above, you can’t pick a lag-reducing option as they both have different uses.

They are not optional.

Not to repeat what’s been said, but they are used for completely different purposes and so ‘what’s better?’ is a very ill-formed question.

As far as reducing lag, which signal is fired really does not matter. Both FireClient and FireServer take in some arguments, convert them into JSON strings and send the data over the network. The receiving machine (server/ your computer) picks it up, converts it back into a RBX type and invokes the signal handler function you connected with either :OnServerEvent or :OnClientEvent.

If you have issues with remotes and lag, then you might be sending remotes very frequently or with large amounts of data.

2 Likes

There’s no better one. You will need to use them both depending on what you are doing. You can’t exclude one for the other, it’ll make scripting harder

Just a heads up - since this is more of a scripting related question, it’s been moved to scripting support.

1 Like