How can I smoothly change the position of a model?

I’ve tried lerping and using the SetPrimaryPartCFrame function of models, but the movement is very choppy. My script uses path finding as well, so I think the problem may be there as well.

Here’s my script:

-- changing positions
local iterations = math.abs((hitBox.Position - Vector3.new(pos)).magnitude)/100
for i = 0, 1, iterations/math.floor(10^math.log10(iterations)*10) do
	self.model:SetPrimaryPartCFrame(hitBox.CFrame:Lerp(pos, i))
	wait(1/100)
end

-- pathfinding
local character = player.Character or player.CharacterAdded:Wait()
local hitBox = self.model.HitBox
			
local startPos = hitBox.Position
local endPos = character.PrimaryPart.Position
			
local path = PathfindingService:CreatePath({
	["AgentRadius"] = math.clamp(hitBox.Size.X + hitBox.Size.Y + hitBox.Size.Z, .2, .5),
	["AgentHeight"] = math.clamp(hitBox.Size.Y, .5, 3),
	["AgentCanJump"] = false,
})
			
local created, newPath = pcall(function()
	return path:ComputeAsync(startPos, endPos)
end)

if created then
	local waypoints = path:GetWaypoints()
	for _, waypoint in ipairs(waypoints) do
		local moveToSuccess, err = pcall(function()
			return self:MoveTo(CFrame.new(waypoint.Position))
		end)
		if not moveToSuccess then
			warn(err)
		end
	end
end

You should be using tweening for smooth movement.

I haven’t messed with model movement much but wouldnt TweenService be the most handy in this situation? Obviously, Model doesn’t have a Position attribute, so you’d have to calculate each parts new position.
Maybe something like this?

local tweeninfo = TweenInfo.new(1,Enum.EasingStyle.In)
local TweenService = game:GetService("TweenService")
local endpos = Vector3.new(0,0,0) -- Obviously, the actual end point
for x in pairs(self.model:GetChildren()) do
   TweenService:Create(x,tweeninfo,{Position=Vector3.new(endpos.X, endpos.Y + (game:GetService("Workspace").Baseplate - x.Position.Y), endpos.Z)}):Play()