Whenever I run my rendering function for my pet system, it uses A LOT of memory. To put it into perspective, it uses more memory that the constant raycast I cast to the floor to make the pet’s CFrame relative.
Here you can see the total ms measured for just that function. Apparently PivotTo uses A LOT of memory.
local function MoveTowards(pet, targetCFrame, speed, minDistance, maxDistance, lerpAlpha, deltaTime)
local PetPivot = pet:GetPivot()
if not PetPivot then return end
local distance = math.clamp((targetCFrame.Position - PetPivot.Position).Magnitude, 0, maxDistance)
local alpha = math.clamp(lerpAlpha * distance, 0, 1)
pet:PivotTo(PetPivot:Lerp(limitCFrameY(targetCFrame,minY,maxY), alpha))
end
They will always be relative to the character to a fixed position and it wont make them feel alive, games only do this if they have a racing mechanic where the character have to go really fast and CFraming it wont work as the character is too fast. That is not the case here
I don’t think the memory being used is enough to directly lag them on let’s say an average modern device, so they wont really complain. The problem is that the resources that are being used are too much memory for that one task. It is very concerning that just that pivotto function uses 20% of the entire client’s memory. Also the entire system is on client.
Okay I just did a quick test in studio pivoting and lerping a giant model, but my memory usage was still very low, so I have no clue why yours is so high. Although my script activity on the other hand was very high.
Roblox does so much nonsense under the hood—you have no way to actually control your memory usage at a fine grained level. I just mean that it’s not worth it to stress over the effect of five lines of code. Does it do the thing you want it to do without crashing? Great, done, go implement the next feature.