Strange delay in spawning escalator steps occurs

Hi! I was making an escalator but then I encountered a script delay.

How the script affected the escalator?
When I run the code, it ends up having a gap between the escalator.

The script:

local steps = script.Parent:WaitForChild("Steps"):GetChildren()

table.sort(steps, function(a, b)
	return a.Position.Y < b.Position.Y
end)

local startPos = steps[10].Position
local endPos = startPos.Y - (#steps - 1) * steps[10].Size.Y

local speed = 1

local tweenService = game:GetService("TweenService")
local info = TweenInfo.new(speed, Enum.EasingStyle.Linear, Enum.EasingDirection.InOut)

while wait(speed) do

	for _, step in pairs(steps) do

		if step:IsA("Part") then
			local y, z = (1/speed) * step.Size.Y, 1 * step.Size.Z

			step.Velocity = Vector3.new(y, z, 0)

			if math.floor(step.Position.Y + 0.5) <= math.floor(endPos) then
				step.Position = startPos
			end

			local tween = tweenService:Create(step, info, {Position = step.Position - Vector3.new(-step.Size.Y, step.Size.Z, 0)})

			tween:Play()
		end

	end

end

How many steps are there?
There are 11 steps in the model.

I would like suggestions on how to fix this issue. Thanks!