Is it possible to create my own :Connect(function()

Greetings! I have my game that uses a TON of BindableEvents, and when I say tons, I really mean tons.

Is it possible for me to convert a lot of them so I do not need to do BindableEvent.Event:Connect(function()? Instead, I want to do CustomEvent:Connect(function() so I can keep my code clean and readable.

I have seen this behavior across multiple ModuleScripts, including ZonePlus, and MatchmakingService.

Thanks in advance!

1 Like

What you are talking about is a custom signal implementation. There’s a nice comparison / reference you can check out here:

1 Like

You could just assign the Bindable.Event RBXScriptSignal object to a variable and then call the instance method :Connect() on that instead.

local Event = BindableEvent.Event
Event:Connect(function(...)
	print(...)
end)
4 Likes