RBXScriptSignal:Connect doesn't actually error when a non function is passed

Reproduction Steps
Passing any non function to the function parameter of the RBXScriptSignal:Connect function will reveal this issue.
Example:

local b = Instance.new"BindableEvent"
local f = setmetatable({},{__call=print})
local c = b.Event:Connect(f) -- outputs an error, but no error is generated
b:Fire(1) --> table: 0xXXXX 1
b:Fire(1,2) --> table: 0xXXXX 1 2
b:Fire(1,2,3) --> table: 0xXXXX 1 2 3
print(c.Connected) --> true

Expected Behavior
The expected result of passing a non function to the function parameter of the RBXScriptSignal:Connect function is an error.

Actual Behavior
Upon running the example code in the command line:
https://i.gyazo.com/4a8587a31b0e246e4bc2188d933b5df0.png
The “error” is just something outputted by the RBXScriptSignal:Connect function, and not an actual error. This causes the code after the “error” to run, and a valid RBXScriptConnection object is returned.

Issue Area: Engine
Issue Type: Other
Impact: Low
Frequency: Very Rarely

6 Likes

We evaluated this before and throwing an actual error might change behavior of existing experiences.
As you saw, even with a message, the callable table is getting called.

5 Likes