Ive seens script with multiple
end) end)
and wondering how do you know how many you need? :s
They're a few things that require ends. If you have any of the following, you require an end
while / do if / then for / do function
You should put an end where you want a 'scope' to end. It's difficult for me to describe a scope, so here's an example
while wait() do --start of our scope print("Hi") --we want this in our scope still print("This too") --also want this in our scope end -- end of scope print("We only want this to print once") --This will only print once, because it's outside of the scope of the while wait() do
With that said, you'll see things like
end)
This is because the start of the scope has an open parentheses somewhere. The most common place I see this is the following:
script.Parent.Touched:connect(function(hit) --Notice how we have two open parentheses, but only one close end) --that final end parentheses closes the open parentheses, and marks the end of our function scope
I'll explain the odd looking function line if you message me on Roblox (my username is Lupine)
Hope this helped!
Lupine has described scopes for you, which is a good way of telling to add "end"s. ROBLOX updates, as hi12325 said, have added that some "end"s are automatically given. My advice is simple.
A red line will usually appear when an end is needed. Also when you run your script there will be an error saying something like "end expected somewhere" or something like that.
Refer back to Lupine's post for scopes, and remember that Studio usually helps you out.
Usually with new roblox updates, It will automatically put an end so don't worry too much about it.
Maybe, errors will tell you if Roblox doesn't add it. I am not the best.