So what the line of code does below is it goes into a model named "SortedTimes" and sorts them based on their values from least to greatest from 1 to 10+. I am trying to get this to check if any of the values are the same number and if they are the same number then I want the code below to change the names of the values to the same name. (Ex 1,1,2,3,4 and so on.) instead of (ex. 1,2,3,4). Can someone help me PLEASE?
local Times = {}
for _, intValue in pairs(script.SortedTimes:GetChildren()) do
local inserted = false
for i, time in pairs(Times) do
if intValue.Value < time then
inserted = true
table.insert(Times, i, intValue.Value)
break
end
end
if not inserted then
table.insert(Times, #Times+1, intValue.Value)
end
end
local intValues = script.SortedTimes:GetChildren()
for i, time in pairs(Times) do
for intValueKey, intValue in pairs(intValues) do
if time == intValue.Value then
intValue.Name = i
table.remove(intValues, intValueKey)
break
end
end
end

1 comment
Thanks for the help. Useless community... -.-