Heartbeat and For Loop causing ping to spike

I am creating a first person system, and while making my first person model copy the motor transform/c0 it apparently causes my ping to spike. I don’t know how performant it is to use heartbeat and for looping but I can’t think of any other way.

Here is my code:

-- Update Function --
runservice.Heartbeat:Connect(function(dt)
	controller:Customize(controller.Rig)
        -- Below is the functions --
	controller:UpdateMotors(controller.Arms)
	controller:UpdateMotors(controller.Rig)
        -- Above is the functions
	controller:Customize(controller.Arms)
end)

-- Motor Update Function --
function controller:UpdateMotors(model)
	if self:Exists(model) and self:Character() then
		for index, value in next, model:GetDescendants() do
			if not self:Character():FindFirstChild(value.Name, true) or not value:IsA("Motor6D") then
				continue
			end
			value.C0 = self:Character():FindFirstChild(value.Name, true).C0
			value.Transform = self:Character():FindFirstChild(value.Name, true).Transform
		end
	end
end

Using heartbeat is like using a while loop. You want to use the code in a way so that you are not abusing it. Enable it only when needed and disabled it when you don’t need it.

I understand that, I am just confused on how exactly I can fix it so my ping wont spike.

I can’t even think of a case Heartbeat would be used and not mess things up at some point, try Stepped.