I have the original coding here:
local player = game.Players.LocalPlayer
local slots = script.Parent.Background.Tool.Slots:GetChildren()
-- Sorting system --
local resorted = {}
for i, v in pairs(slots) do
print(v)
table.insert(resorted, tostring(v))
end
table.sort(resorted)
print(table.concat(resorted, ' '))
player.Inventory.ChildAdded:connect(function(obj)
if obj.ItemType.Value == 2 then
for i, slots in pairs(resorted) do
if slots.Image == "" then
local find = game.ReplicatedStorage.InvenFrames.Tools:FindFirstChild(obj.Name)
slots.Image = find.Image
slots.ItemName.Value = obj.Name
for i, clone in pairs(find:GetChildren()) do
if clone:IsA("Folder") then
clone.Parent = slots
return nil
end
end
end
end
end
end)
But when I go back to use the newly sorted version, I can't. Any help?

4 comments
On line 7, do you mean v.Name?
No
What does your question mean? What do you mean "go back to use" it? What is the actual problem? What are you trying to do? What happens instead?
So, whenever an item goes into the inventory a picture goes to a slot but, the slots do not fill correctly. So the spots get filled randomly and in sequential order. Whenever I resorted it, I couldn't go back and use the sorted table.