#Sorry for the bad title
I have over 20 buttons in my main gui, and the way i would think to know if they were click is:
script.Parent.Frame:FindFirstChild(tostring(1)).MouseButton1Click:connect(function()
--do stuff
end)
script.Parent.Frame:FindFirstChild(tostring(2)).MouseButton1Click:connect(function()
--do stuff
end)
script.Parent.Frame:FindFirstChild(tostring(3)).MouseButton1Click:connect(function()
--do stuff
end)
script.Parent.Frame:FindFirstChild(tostring(4)).MouseButton1Click:connect(function()
--do stuff
end)
script.Parent.Frame:FindFirstChild(tostring(5)).MouseButton1Click:connect(function()
--do stuff
end)
But this would get annoying to use, because it's so big for just getting the clicked. The question is, how do i get the clicked gui, without doing all these events?

4 comments
So v is the item that was clicked?
Yes. v is the variable given in the for loop. The for loop is getting an index value and it's coexisting value, being i and v. v is being connected to its own event. However one the for loop is over the only way to identify if a button was hit is when in the event you use that v variable. You can change v to whatever you want it's a variable for value.
OK, so the way i see it, when you click anything, in the frame, it'll make the var v equal to the textbutton that was clicked, correct?
Essentially yes.