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