What are RemoteFunctions and BindableFunctions?

The title explains the topic of this post, what are remote and bindable functions and what are some common uses of them?

If you could share any common use code below it would be appreciated!

1 Like

It is pretty much self-explanatory from searching up either here on DevForum or Developer Hub. However, if you can’t distinguish their differences, let’s break them down:

BindableFunctions
These are somewhat like BindableEvents, but always returns something to the caller. Let’s say there are two scripts: Script A and script B.

A calls the BindableFunction(optionally with any parameter if necessary) which B has “bound” a function to it, which B will use return in this function to send A anything. A will receive everything B’s single function that has bound to BindableFunction. An example of this is that A fires to B when A is expecting a variable to be assigned a value. B sends the value through return on the function bound. A receives this value and the variable is now assigned to this value.

More information here:

RemoteFunctions
These are primarily used for client-server communication. They are similar to BindableFunctions. Client requests to server through RemoteFunction and then the client yields until a value is returned. The server runs the function bound to this RemoteFunction and gives the client the values from the request and vice versa for server to client. This is not exactly reliable since it can yield, meaning if the function on the client does not work, the server’s script will remain yielding and cannot move on.

More information here:

3 Likes

So a BindableFunction runs Server-Server-Server or Client-Client-Client like a bindable event?

Exactly like that, it runs between two scripts and going back to the caller as I have previously stated. It does not cross server-client boundaries though.

1 Like