im using a renderstepped loop so im not sure why its happening

here is the code

local currentTilt = 0
local tiltSpeed = 10
local function lerp(a, b, t)
return a + (b - a) * t
end
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
local targetTilt = sway.Amount
currentTilt = lerp(currentTilt, targetTilt, deltaTime * tiltSpeed)
local currentCFrame = camera.CFrame
local x, y, z = currentCFrame:ToEulerAnglesYXZ()
local newCFrame = CFrame.new(currentCFrame.Position) * CFrame.fromEulerAnglesYXZ(x, y, z + (currentTilt * deltaTime))
camera.CFrame = newCFrame
end)

Alright I tried this but cranking it up made the effect greater and more jittery and making it lower made the effect barely noticable but stopping the jitter

yeah so the sway is actually the amount that the camera has moved the previous frame in another module, i wasnt sure if i needed too add it since it wasnt exactly the part that wasnt working but here it is

local sway = {}
sway.Amount = 0
local camera = workspace.CurrentCamera
local previousCameraRotation = nil
local swayFactor = 1000
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
local currentCameraRotation = camera.CFrame
if previousCameraRotation then
local difference = previousCameraRotation:Inverse() * currentCameraRotation
local x,y,z = difference:ToEulerAnglesXYZ()
local swayValue = -y
sway.Amount = 1 - (swayValue * swayFactor)
end
previousCameraRotation = currentCameraRotation
end)
return sway

No but let me try that right now, but I have a feeling it has something to do with setting the previousCameraRotation to the currentCameraRotation and then in the main CameraTilt im setting the cframe again but im not sure

I’ve had a similar issue before and I found a thread explaining about the order of exection to fix lerp jittering, but sadly I lost it. Changing RenderStepped to Stepped fixed my issue.

Yeah that jst made the camera spin uncontrollablly, I even made the camera scriptable and create my own custom camera controller and it’s still happening

local UserInputService = game:GetService("UserInputService")
local cameraController = {}
local player = game.Players.LocalPlayer
local character = player.Character
local humanoidrootpart = character.HumanoidRootPart
local camera = workspace.CurrentCamera
local sens = 1
local distance = 8
local maxAngleY = 55
local previousCameraCFrame = nil
local factor = 800
local sway = 0
local currentAngleX, currentAngleY = 0,0
for i = 1,10 do
camera.CameraType = Enum.CameraType.Scriptable
end
local function Lerp(a,b,t)
return a + (b - a) * t
end
game:GetService("RunService").RenderStepped:Connect(function(dt)
local currentCameraCFrame = camera.CFrame
if previousCameraCFrame then
local difference = previousCameraCFrame:Inverse() * currentCameraCFrame
local _,y,_ = difference:ToEulerAnglesXYZ()
sway = Lerp(sway, 1 - (y * factor), dt * 10)
end
if UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
local delta = UserInputService:GetMouseDelta()
currentAngleX = currentAngleX + delta.X * sens * dt
currentAngleY = math.clamp(currentAngleY + delta.Y * sens * dt,-math.rad(maxAngleY), math.rad(maxAngleY))
else
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
camera.CFrame = CFrame.new(humanoidrootpart.CFrame.Position) * CFrame.fromEulerAnglesYXZ(-currentAngleY, -currentAngleX,sway * dt) * CFrame.new(0,1, distance)
previousCameraCFrame = currentCameraCFrame
end)
return cameraController