One of my friends made some save/load scripts which saves and reloads the items back into the inventory GUI, but it doesn't position the buttons in order. Here's the loading script:
-- Script
game:GetService("Players").PlayerAdded:connect(function(Plr) Plr.CharacterAdded:connect(function(Char) Plr:WaitForDataReady()
for _, v in pairs(game:GetService("ReplicatedStorage").Buttons:GetChildren()) do if Plr:LoadString(v.Name) == v.Name then print(Plr:LoadString(v.Name)) cl = v:Clone() cl.Parent = Plr.PlayerGui.Inventory.Frame.Items end end end) end)
--
What I need to know is how to re-position the buttons every time they load back, or 1 button is removed. Example: You have 5 items, you take item 4 out and item 5 moves to the place of item 4. When it loads, it positions them all in order.
I'd really appreciate any help, or some sort of tutorial. Thanks for reading.