local U={}while true do local C={nil;math.huge}for U,y in pairs(mainFolder:GetChildren())do if not y:IsA("\066\097\115\101\080\097\114\116")then continue end local L=string.split(y.Name," ")if#L~=2 then continue end local v=tonumber(L[2])if string.lower(L[1])=="\100\101\115\116\105\110\097\116\105\111\110"and(v and v<C[2])then C={y,v}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,y in pairs(U)do alignPosition.Position=U[C]task.wait(moveDelay)end end
-- Creating a sorted list of positions to move between
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
