You can write your topic however you want, but you need to answer these questions:
I want to make a more proficient code when it comes to Making buttons how would i code this better? I know about i,v in pairs but what exactly do i need to do?
What is the issue? Include screenshots / videos if possible!
This Seems not effective and slow and not good looking code
What i can mainly think of is going through for i,v in pairs and checking for the buttons name is this then do that but i’m not exactly sure if this is the best option
for _, button in pairs(Frame:GetDescendants()) do
if button:IsA("TextButton") or button:IsA("ImageButton") then
if button.Name == "MatchingName" then
button.MouseButton1Click:Connect(function()
end)
end
end
end
One thing though you check is the matching name then you connect the function to the button don’t you have to copy and paste the mousebutton1click again to the other if statements?
for _, button in pairs(Frame:GetDescendants()) do
if button:IsA("TextButton") or button:IsA("ImageButton") then
button.MouseButton1Click:Connect(function()
if button.Name == "MatchingName" then
end
end)
end
end