Tower Defense Movement system glitchy

Well, i’m creating a tower defense game with some friends, and im working the movement system, but it didnt go as much as i planned to…
Is there any way to fix this “teleport” that it does?

https://gyazo.com/75387f6372104f370ee30adaeb0ff69f

movement code:

function module:Move(TEMPLATE:BasePart, deltaTime:number)
	local cframe = TEMPLATE.CFrame
	local distance = (cframe.Position - waypoints[TEMPLATE:GetAttribute('MovingTo')].Position).Magnitude
	--print(distance)
	
	if distance < 0.5 then
		if TEMPLATE:GetAttribute('MovingTo') == #waypoints:GetChildren() then
			TEMPLATE:Destroy()
		else
			TEMPLATE:SetAttribute('MovingTo', TEMPLATE:GetAttribute('MovingTo') + 1)
		end
	end
	
	local speed = TEMPLATE:GetAttribute('Speed') * deltaTime
	local estimatedTime = speed / distance
	local alpha = math.min(estimatedTime, 1)

	serverToClient.UpdateRender:FireAllClients(TEMPLATE:GetAttribute('ID'), TEMPLATE.CFrame, waypoints[TEMPLATE:GetAttribute('MovingTo')].Position)
	cframe = cframe:Lerp(CFrame.new(Vector3.new(waypoints[TEMPLATE:GetAttribute('MovingTo')].Position.X, TEMPLATE.Position.Y, waypoints[TEMPLATE:GetAttribute('MovingTo')].Position.Z)), alpha)
	TEMPLATE.CFrame = cframe
end