Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

RemoteFunctions or RemoteEvents, which should I use when?

Asked by 5 years ago

I've heard that remotefunctions are faster than remoteevents. Since remotefunctions can do everything remoteeevents can do, what is the purpose of remoteevents? I was looking at a GUI catalog and they use remotefunctions instead of remoteevents.

Which should be used when?

1 answer

Log in to vote
1
Answered by 5 years ago

RemoteFunctions are designed for two way communication, while RemoteEvents are designed for one way. A RemoteFunction sends a request and then waits for a response, while RemoteEvents just send a request.

Another difference is how they are handled, RemoteEvents use the Roblox event systems, something like FireServer() or OnServerEvent. RemoteFunctions use a callback. For every RemoteFunction, only one callback can be defined on the server and only one for each client.

The last difference is how many different targets remote events and functions can have. For both RemoteEvents and RemoteFunctions, a client can contact the server and the server can contact the client. In the case of RemoteEvents, the server can also contact every client at the same time.

With this information you can decide what and where you use them. As I said before, the main difference is that RemoteFunctions waits a response. I hope I helped!

0
I didn't ask you to copy and paste the wiki. Thepoint13 99 — 5y
0
I've not copied the wiki. This is all I know from what I used. Hmph. EternalScythe 222 — 5y
0
I'll accept your answer if you can answer this: Why do some scripts use remotefunctions when remoteevents should be used? Thepoint13 99 — 5y
0
"Should" Is not the right way of saying it. RemoteFunctions, will send a request to the server, and then WAIT for a request to the client, if that request to the client is not sent, it will error. That's why people use mostly remoteevents, because normally, you dont send any data to the client after sending to the server. But yes, there are cases where you want to send a request to the client. EternalScythe 222 — 5y
0
This means if you dont send a request to the client with ``InvokeClient()`` after sending it with ``:InvokeServer()`` it will error. EternalScythe 222 — 5y
Ad

Answer this question