Do you really need to index each of your values with numbers like 10,250,10000 ? That might be the problem here, so try to see if you can instead place the key (10,100,250, etc…) inside of the element (in the table, maybe like “key=10”?) and have your tables inserted in your table t like you would for a normal array (t = {1, 2, 3, ...}).
Btw, you can use for i, v in t do, roblox lua will automatically pick the pairs or ipairs depending on what type the table is.
--convert the table t to a normal array with index as a property of its values
local newt = {}
for i, v in pairs(t) do
v.Index = i
table.insert(newt, v)
end
--sort the array in ascending order by said property
table.sort(newt, function(a, b)
return a.Index < b.Index
end)
for _, v in pairs(newt) do
print(v.Index) --indexes should be printed in ascending order
end
just make a for loop, and start at 1 and continue till how many indexes are in the table. the for loop does in order no matter what, and you can get v by doing t[i]