I have multiple templates in the same frame, why is only one button appearing to be visible?
Script:
for _, Button in pairs(Main.Template.Container.DropDown:GetChildren()) do
if Button:IsA("TextButton") then
if Button.Name == "Button" then
Button.Visible = true
end
end
end
-- This must a client script
local function loopThroughObjects(objectToLoopThrough : Instance): {}
local tableToReturn = {}
for k, v in pairs(objectToLoopThrough:GetChildren()) do
if v:IsA("TextButton") and v.Name == "Button" then
table.insert(tableToReturn, v)
end
end
return tableToReturn
end
for k, v in pairs(loopThroughObjects(Main.Template.Container.DropDown)) do
v.Visible = true
end
for i, Button in ipairs(Main.Template.Container.DropDown:GetDescendants()) do
if Button:IsA("TextButton") and Button.Name == "Button" then
Button.Visible = true
end
end
for _, Template in ipairs(Main:GetChildren()) do
if Template.Name == "Template" then
for i, Button in ipairs(Template.Container.DropDown:GetChildren()) do
if Button:IsA("TextButton") and Button.Name == "Button" then
Button.Visible = true
end
end
end
end