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 -
for i = 0, 1, iterations/math.floor(10^math.log10(iterations)*10) do
	self.model:SetPrimaryPartCFrame(hitBox.CFrame:Lerp(pos, i))

-- 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)

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

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 =,Enum.EasingStyle.In)
local TweenService = game:GetService("TweenService")
local endpos =,0,0) -- Obviously, the actual end point
for x in pairs(self.model:GetChildren()) do
   TweenService:Create(x,tweeninfo,{, endpos.Y + (game:GetService("Workspace").Baseplate - x.Position.Y), endpos.Z)}):Play()