So ever since the new FPS selector got added into roblox’s settings. I’ve noticed that my gun’s recoil would multiply the higher the frames you were running.

I did a ton of research and came to a conclusion of using RenderStepped DeltaTime to make the recoil caluculations parallel to the clients frames.

I’ve tried every way i could like, dividing the recoil or multiply the recoil but nothings working. This is just very exhausting for me and im losing motivation to keep trying to fix this.

Any fixes or idea’s on how to implement deltaTime would be greatly appreciated.

local function RecoilCamera()
if Module.CameraRecoilingEnabled then
RunService.RenderStepped:Connect(function(DeltaTime)
-- I put in delta time here ^^^^
local Recoil = AddressTableValue(Module.ChargeAlterTable.Recoil, Module.Recoil)
local CurrentRecoil = Recoil * (AimDown and 1 - Module.RecoilRedution or 1)
local RecoilX = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleX_Min, Module.AngleX_Max, Module.Accuracy))
local RecoilY = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleY_Min, Module.AngleY_Max, Module.Accuracy))
local RecoilZ = math.rad(CurrentRecoil * Math.Randomize2(Module.AngleZ_Min, Module.AngleZ_Max, Module.Accuracy))
Knockback:Accelerate(Vector3.new(-RecoilX * Module.ScopeKnockbackMultiplier, - RecoilY * Module.ScopeKnockbackMultiplier, 0))
CameraSpring:Accelerate(Vector3.new(RecoilX, RecoilY, RecoilZ))
CameraSpring:Accelerate(Vector3.new(RecoilX , RecoilY, -RecoilZ))
-- THIS IS THE MODULES SETTINGS JUST INCASE YOU NEED REFERENCE
--[[
CameraRecoilingEnabled = true;
Recoil = 100;
AngleX_Min = 1.13; --In degree
AngleX_Max = 1.13; --In degree
AngleY_Min = -0.12; --In degree
AngleY_Max = 0.12; --In degree
AngleZ_Min = -1; --In degree
AngleZ_Max = 1; --In degree
Accuracy = 0.2; --In percent. For example: 0.5 is 50%
RecoilSpeed = 55;
RecoilDamper = 0.50;
RecoilRedution = 0.5; --In percent.
]]
end)
end
end

You’ll need to implement deltaTime. Heartbeat, RenderStepped etc all pass it as a parameter. I’m not gonna give you code you could copy-paste, but I’ll give you a general idea.

Consider we have this code, that moves a part forward every frame.

But, if our fps was higher, the function would run more often, thus resulting in faster movement. If we however add deltaTime

local speed = 5
RunService.Heartbeat:Connect(function(deltaTime) -- deltaTime is the time since the last frame to the current one
part.Position += Vector3.new(0, 0, speed * deltaTime)
end)

then the part actually moves at a constant speed, even when fps changes

you don’t quite understand how Vector3s work it seems

you’re only multiplying the speed by the RecoilZ axis, which i assume would be up/down which is why you are seeing this flinging only on that axis. you need to multiply the speed on every axis. in a vector3, nothing after the commas affects what comes before it, unless you multiply outside of the parentheses.

also, i dont see anywhere here you’re actually multiplying by deltatime.