Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Differences between "end" and "end)"?

Hello, Im pretty new to scripting, so Im just confused about the differences between "end" and "end)".

2 answers

✓ Accepted answer

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!

2 comments

2

This is correct ^^. The braces are argumental parentheses, and are expecting a function callback. The end just happens to meet the closing bracket.

0

Alright, thanks so much!

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

0

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.