Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Sort TextButtons by Position?

Asked by 10 years ago

I'm Currently Working on a inventory system and everything went well in till i ran into this stumbling block. It seems the item will appear in the second Button.

http://prntscr.com/4hhcha

Im thinking this is due to the sorting of the Buttons but I do not know how to Sort the buttons by Position size.

player = Game.Players.LocalPlayer
PlayerStats = player.PlayerStats
Inv = PlayerStats.Inventory
Eq = Inv.Equipment
Frme = script.Parent
Button = Frme.Parent.Frame.Equipment
Working = false

function Check()
    for i,v in pairs(Eq:GetChildren()) do
        if v then
            Working = true
            for f,b in pairs(Frme:GetChildren()) do
                if b.Name == "Empty" and Working then
                    b.Text = v.Name
                    b.Name = Equipment
                    Working = false
                end
            end
        end
    end
end


Button.MouseButton1Down:connect(Check)


Answer this question