Pet Movement Problem

I am creating a pet following system, but the pets in this system do not move smoothly, can you help me? Also PetSlot is Model.

local TweenService = game:GetService("TweenService")
local AnimDebounce = false

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        workspace:WaitForChild(player.Name)

        local HRP = character:WaitForChild("HumanoidRootPart")
        local PetSlot = game.ReplicatedStorage.PetSlot:Clone()
        PetSlot.Parent = character
        PetSlot.PrimaryPart = PetSlot:FindFirstChild("PetPrimaryPart")
        
        local HRPPosition = HRP.Position
        
       game:GetService("RunService").Heartbeat:Connect(function()
            if AnimDebounce == false then
                AnimDebounce = true
                HRPPosition = HRP.Position
                local function createFollowAnimation(partToFollow, targetPart)

                    local tweenInfo = TweenInfo.new(
                        0.25,                 -- Süre
                        Enum.EasingStyle.Quad, -- Easing stili (opsiyonel)
                        Enum.EasingDirection.Out -- Easing yönlendirmesi (opsiyonel)
                    )
                    local goal = {}
                    goal.CFrame = targetPart.CFrame

                    local tween = TweenService:Create(partToFollow, tweenInfo, goal)

                    tween:Play()
                    tween.Completed:Connect(function()
                        if partToFollow.CFrame ~= HRP.CFrame then
                            createFollowAnimation(PetSlot.PrimaryPart, HRP)
                        else
                            AnimDebounce = false
                        end
                    end)
                end
                createFollowAnimation(PetSlot.PrimaryPart, HRP)
            end
        end)
    end)
end)
1 Like

Does changing 0.25 to .1 do anything beneficial?

Unfortunately no, this only makes the animation run faster but does not provide smoothness.

I would target this part here.

you shouldnt animate stuff on the server, replicate it to the clients instead

To put it briefly, how can I do it?