i have a script, everything works but when the player moves backwards or side to side it can be a lil choppy
local cam = game.Workspace.CurrentCamera
local RunService = game:GetService("RunService")
local char = script.Parent
local hum = char:FindFirstChild("Humanoid")
local UIS = game:GetService("UserInputService")
RunService.RenderStepped:Connect(function ()
UIS.MouseBehavior = Enum.MouseBehavior.LockCenter
if hum.Sit == true then return end
hum.CameraOffset = Vector3.new(3,1,0)
local x, y, z = cam.CFrame:ToOrientation()
local currentPosition = char.HumanoidRootPart.Position
local newCFrame = CFrame.new(currentPosition) * CFrame.Angles(0, y, 0)
char.HumanoidRootPart.CFrame = char.HumanoidRootPart.CFrame:Lerp(newCFrame, 1)
end)