I'm working on an FPS game and one of the big problems is uncapped FPS for I use RenderStepped for pretty much everything in the Framework as well as other things. I realize this is bad practice for those such as myself wanting to play the game in a higher FPS but after reading a lot and a lot about Delta Time I just can't understand it, here's a code that I tried but it does nothing and I really just don't know what to do.
run.RenderStepped:Connect(function(deltaTime)
local originalDeltaTime = deltaTime
while deltaTime < 1/60+1/((1/originalDeltaTime)+4) do
deltaTime = deltaTime + game:getService("RunService").RenderStepped:Wait()
secrecoil()
end
end)
function secrecoil()
if cam:FindFirstChild(secondary.Name) then
if secondary[secondary.Name].Flame.ParticleEmitter.Enabled == true then
local random = math.random(2)
if random == 1 then
for i = 0,s.recup, .1 do
camcf = camcf * s.recoil
run.RenderStepped:Wait()
end
for i = 0,s.recdown, .1 do
camcf = camcf * s.recoil2
run.RenderStepped:Wait()
end
elseif random == 2 then
for i = 0,s.recup, .1 do
camcf = camcf * s.recoil3
run.RenderStepped:Wait()
end
for i = 0,s.recdown, .1 do
camcf = camcf * s.recoil4
run.RenderStepped:Wait()
end
end
end
end
end
Anything would be helpful at this point. I wanna future proof this game and this is one of the big steps I gotta take.

1 comment
Even after using this function it still plays at the same speed no matter what the framerate is, the code still works just not as intended.