no output

function removeOldOutOfTheWay(objects)
    for _, child in pairs(objects) do
        if child.Name == "Items" then
            child:Destroy()
        end
    end
end

function UpdateItems()
    local x, y = 0, 0.2
removeOldOutOfTheWay(gui.Main.Items:GetChildren())
    local lo = gui.Parent.Parent.Character:GetChildren()
    for _, child in pairs(lo) do
	if lo.className == "Hat" then
       local new = settings.Items:Clone()
        new.Position = UDim2.new(x, 0, y, 0)
        new.Text = child.Name
        x = x + 0.031
new.Parent = gui.Main.Items
      end
    end
end
local a = gui.Parent.Parent.Character
a.ChildAdded:connect( UpdateItems )
a.ChildRemoved:connect( UpdateItems )
UpdateItems()

2 comments

0

Next time post what you're trying to do, and what's not happening.

0

trying to make it get the children from the character then if the classname is hat then clone the textbutton to the gui with the name for each child