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

How do I Pass on functions (as arguments) between scripts?

Asked by 8 years ago

I'm trying to make two scripts communicate.

One passes a function as an argument to another when .new() is called.

What is the best way to implement this?

For example, I have tried passing a function as an argument to fill a Bindable function event



function GUI.new(PARENT, CLICKEFFECT, CARD) local card = Instance.new("ImageButton", PARENT) local clickEffect = Instance.new("BindableFunction", card) clickEffect.OnInvoke = (CLICKEFFECT) card.MouseButton1Down:connect(clickEffect:Invoke); --ERROR how do I get around this? end --And in a seperate ModuleScript Card = GUI.new(SomeRandomObject, function()print(i)end , SomeRandomCard)

Answer this question