Hello, Im pretty new to scripting, so Im just confused about the differences between "end" and "end)".
Differences between "end" and "end)"?
2 answers
In Lua, there is no end). end and ) are two different things. ) is used to close something when it is opened with (. For example:
local func = function() print("hello") end
string.dump(func)
This is the same as:
string.dump(function() print("hello") end)
Only difference is that the function has a ( before it starts. So you have to end the function with ). Hopefully this helped!
end is used to wrap up if statements, loops, etc.
What end) does is ends :Connect()
script.Parent.Touched:Connect(function() there is one parenthesis missing here, so you must include it when you say end. This will make it end)
end wraps something up when there is not a parenthesis missing, while end) is used when you need an extra parenthesis, like in the :Connect() example.
1 comment
It's not privy to Connect. Connect expects a function callback as an argument—standard syntax is (). If you create a function, the end will meet the closing bracket.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
This is correct ^^. The braces are argumental parentheses, and are expecting a function callback. The end just happens to meet the closing bracket.
Alright, thanks so much!