local U={}while true do local c={nil;math.huge}for U,B in pairs(mainFolder:GetChildren())do if not B:IsA("\066\097\115\101\080\097\114\116")then continue end local z=string.split(B.Name," ")if#z~=2 then continue end local n=tonumber(z[2])if string.lower(z[1])=="\100\101\115\116\105\110\097\116\105\111\110"and(n and n<c[2])then c={B;n}end end if not c[1]then break else table.insert(U,c[1].Position)if hideDestinationBlocks then c[1]:Destroy()else c[1].Name="\068\101\115\116\105\110\097\116\105\111\110"end end end alignPosition.MaxVelocity=topSpeed alignPosition.Position=U[1]platform.AlignOrientation.CFrame=platform.CFrame.Rotation platform.Anchored=false while true do for c,B in pairs(U)do alignPosition.Position=U[c]task.wait(moveDelay)end end

local positionList = {}
while true do
	local lowest = {nil, math.huge} -- Contains the destination with the lowest number and its number
	for _, value in pairs(mainFolder:GetChildren()) do
		if not value:IsA("BasePart") then continue end -- Skip this item if it's not a base part
		local nameSplit = string.split(value.Name, " ")
		-- In these conditional statements, we check:
		if #nameSplit ~= 2 then continue end -- That the name contains one space
		local destinationNumber = tonumber(nameSplit[2])
		if string.lower(nameSplit[1]) == "destination" -- The word before the space is "destination"
			and destinationNumber -- The word after the space is a number
			and destinationNumber < lowest[2] -- And the number after the space is lower than the current lowest number
		then
			lowest = {value, destinationNumber} -- If the previous checks succeed, the current part is now the lowest one
		end
	end
	if not lowest[1] then
		break -- End the loop if there are no destination blocks remaining
	else
		table.insert(positionList, lowest[1].Position)
		if hideDestinationBlocks then -- Destroy or rename the current lowest destination to continue the sorting process
			lowest[1]:Destroy()
		else
			lowest[1].Name = "Destination"
		end
	end
end

alignPosition.MaxVelocity = topSpeed
alignPosition.Position = positionList[1]
platform.AlignOrientation.CFrame = platform.CFrame.Rotation -- Match the target orientation to the current orientation
platform.Anchored = false

while true do -- The moving platform can now endlessly go through the sorted list in order
	for index, _ in pairs(positionList) do
		alignPosition.Position = positionList[index]
		task.wait(moveDelay)
	end
end
