How do I stop a CFrame from speeding up?

I was making ADS (Aiming Down Sights) for a viewmodel but the CFrame for the ADS started speeding up for no reason.

robloxapp-20221022-1211270.wmv (1.6 MB)

As you can see in the clip above, the Aiming CFrame gets faster and faster every time I equip the tool.
I have looked at many forum posts but couldn’t find anything about CFrames getting faster.


-- Viewmodel is a pair of arms in the camera
-- AimPart is where I want the viewmodel to go
-- AimSpeed is 0.1

if Aiming then
                local AimOffset = Viewmodel.HumanoidRootPart.CFrame:ToObjectSpace(Viewmodel.Handle.AimPart.WorldCFrame):Inverse()
                AimCF = AimCF:Lerp(AimOffset, AimSpeed)              
                local AimOffset =
                AimCF = AimCF:Lerp(AimOffset, AimSpeed)

I think this topic will be better to post under #help-and-feedback:scripting-support.
Also, the problem you may have is Lerping, bc it’s possible to set lerp more than 1 and less than 0.

Moved the post to #help-and-feedback:scripting-support.
Thanks for pointing it out.

Since i cant see the whole code, i assume that you put the RenderStepped event inside the Equipped event, which is causing the problem. Every time you equip a tool, it connects another function to the RenderStepped event. The more functions connected, the faster CFrame will change

for example:

  • you have equipped the tool 1 time, the function will be called 1 time per RenderStepped.
  • you have equipped the tool 2 times, the function will be called 2 times per RenderStepped.

if i guessed right and you put the RenderStepped event inside the Equipped event, to fix this issue you need to move the RenderStepped out of Equipped event or to disconnect the function from RenderStepped everytime you Unequip the tool by doing so:

local Connection = nil

    Connection = RunService.RenderStepped:Connect(YourFunction)
    -- rest of your code


Thank you so much!
It works now