Can you make like a sorting algorithm something like a quicksort where it'll sorts parts in a model from smallest to tallest but without looping it at all so for example if you were to do
print("Test")
In the start of the sorting it will only print it once?
If it is possible how would you do so?
The only way i know is this
function sortingAlgorithmA(group)
local list = group
local x = 1
game:GetService("RunService").Heartbeat:Connect(function()
if x >= #list then return end
x = x + 1
for i=1, #list do
if i < #list then
local current = list[i]
local adjacent = list[i+1]
if current.Size.Y > adjacent.Size.Y then
local temp = current.Position
current.Position = Vector3.new(adjacent.Position.X, current.Position.Y, 0)
adjacent.Position = Vector3.new(temp.X, adjacent.Position.Y, 0)
current.Ind.Value = not current.Ind.Value
adjacent.Ind.Value = not adjacent.Ind.Value
temp = list[i]
list[i] = list[i+1]
list[i+1] = temp
end
end
end
end)
end
local group = createSortingGroup(Vector3.new(0,0,0), 15)
wait(1)
randomizeSortingGroup(group)
wait(1)
sortingAlgorithmA(group)

2 comments
If you were to do a print it will print it 14 times which i do not wan't it to repeat just sort everything in a single loop
There is no way for a program to even compare all the values in a table without at least looping through it once.