What do I not know?

I’ve stopped developing for over 5 months now. I was scripting and instead of this:

button.MouseButton1Click:Connect(function()
 --code
end

I got:

button.MouseButton1Click:Connect(function()

    end)
end

I was confused because I got an error. I had to add end) then. I then relised I need to refresh my coding skills.
Please leave a comment below about what I maybe don’t know since I haven’t developed in over 5 months.

Both of those error, for what it’s worth. It’s just one end)—the end is for the anonymous function and the ) is because it’s passed as an argument to Connect.

2 Likes

Thanks for telling me this. This helps a lot as I didn’t know this.

This would probably fit better in the #help-and-feedback:scripting-support category

I have switched it. Thanks for reminding me.

RBXScriptSignal:Connect(value) like MouseButton1Click:Connect(value) requires argument, and its should be function variable.

technically function() ~~~ end is variable, and you can set variable using

local func = function() 
  print("func")
end

and you can pass argument using MouseButton1Click:Connect(func),

So, this is same as MouseButton1Click:Connect(func, no ).
Thats why you must add ) at end.

(I’m sorry if it’s hard to understand)

No, its understandable. Thanks a lot!