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

How can I resort my table and still use it?

Asked by 8 years ago

I have the original coding here:

01local player = game.Players.LocalPlayer
02local slots = script.Parent.Background.Tool.Slots:GetChildren()
03-- Sorting system --
04local resorted = {}
05for i, v in pairs(slots) do
06    print(v)
07    table.insert(resorted, tostring(v))
08end
09table.sort(resorted)
10print(table.concat(resorted, ' '))
11 
12player.Inventory.ChildAdded:connect(function(obj)
13    if obj.ItemType.Value == 2 then
14        for i, slots in pairs(resorted) do
15            if slots.Image == "" then
View all 28 lines...

But when I go back to use the newly sorted version, I can't. Any help?

1
On line 7, do you mean v.Name? User#11440 120 — 8y
0
No xXLegendarySoldierXx 129 — 8y
0
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? BlueTaslem 18071 — 8y
0
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. xXLegendarySoldierXx 129 — 8y

Answer this question