Hello, i have this Camera idle movement script that uses BindToRenderStep, which gets affected with fps and makes it run different, i need help making a variable that gets the target FPS and divides it with the current FPS, so it can make the script run the same for everyone.
local speedx,x,speedy,y = 76,0.75,62,0.75
local lspeed = 0.01
local function lerp(s,e,a) return s+(e-s)*a end
local ix = 0
local iy = 0
local pi,sin,pi2 = math.pi,math.sin,math.pi*2
local cam = workspace.CurrentCamera
local lsx,lx,lsy,ly = speedx/1000,x/1000,speedy/1000,y/1000
game:GetService("RunService"):BindToRenderStep("Swaying",201,function()
if game.Players.LocalPlayer.Character:WaitForChild("Humanoid").MoveDirection.Magnitude == 0 then -- we are idle
lsx=lerp(lsx,speedx/1000,lspeed)
lx=lerp(lx,x/1000,lspeed)
lsy=lerp(lsy,speedy/1000,lspeed)
ly=lerp(ly,y/1000,lspeed)
ix = (ix + lsx)%pi2
iy = (iy + lsy)%pi2
cam.CFrame = cam.CFrame * CFrame.Angles(sin(ix)*lx,sin(iy)*ly,0)
end
end)