How can i fix fast lerp

When I change the maximum fps to 240, the Lerp animations become faster

this is how I do it
image

Try this, it would’ve been more helpful if you showed more of the script but I’m assuming that you’re using RunService.

local RunService = game:GetService("RunService")
local inspecting = true 

local inspectcf = CFrame.new() -- Your initial CFrame
local WeaponData = {
    Inspect1 = CFrame.new(0, 0, -5) -- Example CFrame
}

local lastTime = tick()

RunService.RenderStepped:Connect(function()
    local currentTime = tick()
    local deltaTime = currentTime - lastTime
    lastTime = currentTime

    if inspecting then
        local lerpAlpha = 0.2 * deltaTime * 60
        inspectcf = inspectcf:Lerp(WeaponData.Inspect1, lerpAlpha)
    end
end)
2 Likes

Do you know why the gun is shaking now?

The CFrame value is probably too high, adjust it so it stops jittering and that should result in smooth interpolation.

Thank you so much, you helped me a lot!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.