How to use bindable functions?

  1. What do you want to achieve? Keep it simple and clear!
    Hello.
    I want to make a script fire another script and then wait for the script to give information and then continue.
  2. What is the issue? Include screenshots / videos if possible!
    The roblox API doesnt explain how to do this…
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Yes, searched half of google for an answer.

Thanks for answers!

BindableFunction.OnInvoke = yourFunctionHere in the receiving script. Make sure the function returns.
local whateverItReturns = BindableFunction:Invoke(args) in the script waiting for information.

I found this in about 15 seconds by reading the wiki, along with code samples, so I’m not sure how well you searched.

9 Likes

The API reference explains this very clearly, but to summarise BindableFunctions act like RemoteRunctions but can only communicate between scripts of the same scope, e.g. Scripts to Scripts, Local Scripts to Local Scripts.

BindableFunctions can be rigged to return a value, again refer to the API reference.

2 Likes

BindableFunction return “something” back to the Caller, perhaps that’s why it’s called a Callback function; a two way communication method.

You can learn more about BindableFunction;

(You can also learn more about Using Callbacks in Code here)

Additionally if you do not require “something” to be return then you are better off using a BindableEvent