I’m making a game and in ReplicatedStorage is a folder full of hats which are parented to a value of which order they should be pasted into a GUI.
Although when I run this code:
for i,v in pairs(game.ReplicatedStorage.Hats:GetChildren()) do
local gui = game.Players.LocalPlayer.PlayerGui:WaitForChild("Frame"):Clone()
gui.Name = v.HatName.Value
gui.Parent = script.Parent
local name = v.HatName.Value
local vv = v[name].ImageLabel
vv.Size = UDim2.new(0.822, 0,0.815, 0)
vv.Parent = gui
vv.Position = UDim2.new(0.087, 0,0.086, 0)
local a = Instance.new("UIAspectRatioConstraint")
a.AspectRatio = 1.085
a.Parent = vv
gui.TextLabel.Text = v.HatName.Value
gui.Price.Value = v.Price.Value
gui.Multiplier.Value = v.Level.Value
end
It will get all hats and duplicate the frame and add all necessary details but in a random order. How can I make it do it in order according to the Numbers?