How can you return 2 functions in :Connect()

I want to return 2 functions using MouseClick:Connect() but I don’t know how

I tried doing this and it doesn’t work

script.Parent.MouseClick:Connect(onButtonActivated, plus1)

So far this is the only solution which looks ugly imo

script.Parent.MouseClick:Connect(onButtonActivated)
script.Parent.MouseClick:Connect(plus1)

The way you connect two separate functions to a connection like that is pretty alright, but is there a case where you can actually refactor it that you can call the first function which in turns call the second one?

1 Like

You cannot do that, you can only make it like how @anon81993163 said

Merge the two functions together.

Actually, you can bind how many functions you want and regardless how many you bind to it, it will still work. Only problem that may appear is the so-called race conditions(which function gets executed ahead of the other) and is only apparent in the long run.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.