hello, i have a Idle Camera movement that uses RunService and it works fine in studio but in game it gets sped up, i tried doing what worked for other people but cant get it, any help?
Original Script
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)
Mine
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(deltaTime)
deltaTime = deltaTime * 60
if game.Players.LocalPlayer.Character:WaitForChild("Humanoid").MoveDirection.Magnitude == 0 then -- we are idle
lsx=lerp(lsx,speedx/1000,lspeed* deltaTime)
lx=lerp(lx,x/1000,lspeed* deltaTime)
lsy=lerp(lsy,speedy/1000,lspeed* deltaTime)
ly=lerp(ly,y/1000,lspeed* deltaTime)
ix = (ix + lsx)%pi2
iy = (iy + lsy)%pi2
cam.CFrame = cam.CFrame * CFrame.Angles(sin(ix)*lx,sin(iy)*ly * deltaTime, 0)
end
end)