PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

Invoke

Invoke will call the OnInvoke callback and return any values that were returned by the callback (if any). If the OnInvoke callback is not set, this method will yield until one is set. If OnInvoke yields, this method will also yield. There are limitations on the values that can be sent as arguments; see the code samples.

Parameters

Name Type Default Description

Values to be passed to the callback

Returns

Return Type Summary

Values passed to the callback


Code Samples


BindableFunction Addition

This code sample sets the OnInvoke callback of the parent BindableFunction to a function that returns the sum of two numbers. Test this code sample by pasting this code inside a Script within a BindableFunction. You’ll then be able to use Invoke on the BindableFunction from other scripts.


BindableFunction Valid Values

This code sample shows the kinds of values that can be sent to and from BindableFunctions via Invoke/OnInvoke. Test this code by placing a Script within a BindableFunction inside the Workspace or ServerScriptService. It will raise errors on the values that cannot be sent.