How to use the same alpha value for lerp in renderstepped for all framerates

Hey, I’m trying to change the alpha value in lerp based on the frame rate. So far I have tried out using step and mult but the issue is that using either of theses as a alpha value of lerp will result in a lower position offset for higher frame rates which makes sense because step is just 1/fps, but is there a way to update the alpha value so it stays consistent across all framerate’s or should I try to use a different runservice all together.

Here is the script I am running in RenderStepped:

service = RunService.RenderStepped:Connect(function(step)

local moved = false
local noisemovment = false
local newposition = character:WaitForChild(“HumanoidRootPart”).CFrame

local camFrame = game:GetService(“Workspace”).CurrentCamera.CFrame
local newposition = newposition:toObjectSpace(initialPosition)
local cccf_data = camFrame:toObjectSpace(lastCameraCF)
local x, y, z = cccf_data:ToOrientation()
local currcent_handle_Cframe = script.Parent:WaitForChild(‘Handle’).CFrame
local current_handle_Cframe = currcent_handle_Cframe:ToObjectSpace(handle_Cframe)

if shooting then
X, Y , Z = x, y, z
else
X, Y , Z = 0 ,0 , 0
end

script.Parent.HumanoidRootPart.CFrame = camFrame + camFrame.LookVector * 0.5 + camFrame.UpVector * 0.5+ camFrame.RightVector * 0.5
–//swayoffset position
local targetCFrame = CFrame.new(cccf_data.Position/(3+lower_offset_effect))
postionOffset = postionOffset:Lerp(targetCFrame, 0.2 * mult)
local localpostionOffset = workspace.CurrentCamera.CFrame:toObjectSpace(workspace.CurrentCamera.CFrame * postionOffset)
script.Parent.HumanoidRootPart.CFrame = workspace.CurrentCamera.CFrame * localpostionOffset

–//position tilt, donst trigger when aming down sight
if not aimPlaying then
lower_offset_effect = 0
swaytilt = swaytilt:Lerp(CFrame.Angles((-newposition.x)* 0.2 * mult , (-newposition.x)* 0.2 * mult, 0), 0.15)
local handle_cf_toObjectSpace = script.Parent.Handle.CFrame:toObjectSpace(script.Parent.Handle.CFrame * swaytilt)
script.Parent.Handle.CFrame = script.Parent.Handle.CFrame * handle_cf_toObjectSpace
handle_Cframe = script.Parent.Handle.CFrame

else
lower_offset_effect = 2
end

–//swayoffset rotation
swayOffset = swayOffset:Lerp(CFrame.Angles(math.sin(x * 3.5) * mult, math.sin(y * 3.5) * mult, 0), 0.1)
local characterCFrame = script.Parent.HumanoidRootPart.CFrame
local localSwayOffset = characterCFrame:toObjectSpace(characterCFrame * swayOffset)
script.Parent.HumanoidRootPart.CFrame = characterCFrame * localSwayOffset
– Update cumulativeRotation
cumulativeRotation = cumulativeRotation:Lerp(CFrame.Angles(Xmult2, Ymult2, Zmult2), 0.05 )

– Update lastCameraCF with cumulative rotation
lastCameraCF = workspace.CurrentCamera.CFrame * cumulativeRotation + workspace.CurrentCamera.CFrame.LookVector * xvectorvalue

– Apply cumulative rotation to the camera’s CFrame
workspace.CurrentCamera.CFrame = lastCameraCF

–movrement detection
if math.abs(newposition.z) > 0.005 or math.abs(newposition.x) > 0.005 then
moved = true
falsecounter = 0
else
falsecounter = falsecounter + 1
end

if moved == true or falsecounter < 6 then
noisemovment = true
end
initialPosition = character.HumanoidRootPart.CFrame
if not isAnyAnimationPlaying() then
if noisemovment and not walkPlaying then
walk:Play()
walkPlaying = true
elseif not noisemovment and walkPlaying then
walk:Stop()
idle:Play()
walkPlaying = false
end
elseif walkPlaying then
walk:Stop()
walkPlaying = false
end
end)

Here is a clip off how different framerate’s affect the position offset:

You are using lerp.

Lerp needs this special formula

		--local lerpFactor = 1-math.exp(-10*dt)
		local lerpFactor = 1-math.pow(0.5,10*dt)

I have tried using it like this but the offset is still smaller for higher fps:

local lerpFactor = 1-math.pow(0.5,10*step)
postionOffset = postionOffset:Lerp(targetCFrame, lerpFactor)

this is offset in position btw