Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

RemoteFunctions or RemoteEvents, which should I use when?

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

✓ Accepted answer

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!

5 comments

0

I didn't ask you to copy and paste the wiki.

0

I've not copied the wiki. This is all I know from what I used. Hmph.

0

I'll accept your answer if you can answer this: Why do some scripts use remotefunctions when remoteevents should be used?

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.

0

This means if you dont send a request to the client with InvokeClient() after sending it with :InvokeServer() it will error.

This discussion is preserved as it was. New answers, comments, and votes are closed.