For some reason, the main base of my Camera Sway works. But my every time I swing my camera really fast the camera just shoots upwards, and my character sometimes walks in the direction I swing my camera to.

I also have a camera bobbing script that makes the camera jump in a more realistic way, every time the player takes a step.

Here’s the Camera Sway Script:

```
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local swayAmount = Vector2.new(0, 0)
local swaySpeed = 4
local swayLimit = 0.05
-- Adjust the mouse sensitivity
UserInputService.MouseDeltaSensitivity = 0.08
UserInputService.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
swayAmount = swayAmount - Vector2.new(input.Delta.x, input.Delta.y) * swayLimit
-- Clamp the sway amount to prevent it from exceeding the limit
swayAmount = Vector2.new(math.clamp(swayAmount.X, -swayLimit, swayLimit), math.clamp(swayAmount.Y, -swayLimit, swayLimit))
end
end)
RunService.RenderStepped:Connect(function()
swayAmount = swayAmount - swayAmount / swaySpeed
local swayCFrame = CFrame.Angles(swayAmount.Y, swayAmount.X, 0)
camera.CFrame = camera.CFrame * swayCFrame
end)
```

Here’s the Camera Bobbing Script:

```
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local camera = workspace.CurrentCamera
local bobbingSpeed = 5 -- Adjust this value to change the bobbing speed
local bobbingAmount = 0.2 -- Adjust this value to change the bobbing height
local function getBobbingOffset(speed)
local time = tick()
local y = math.abs(math.sin(time * bobbingSpeed)) * bobbingAmount * speed
return Vector3.new(0, y, 0)
end
local function updateCamera()
if player.Character then
local humanoid = player.Character:FindFirstChild("Humanoid")
local rootPart = player.Character:FindFirstChild("HumanoidRootPart")
if humanoid and rootPart then
local speed = rootPart.Velocity.Magnitude / humanoid.WalkSpeed
local offset = getBobbingOffset(speed)
camera.CFrame = CFrame.new(camera.CFrame.p, camera.CFrame.p + camera.CFrame.LookVector) * CFrame.new(offset)
end
end
end
RunService.RenderStepped:Connect(updateCamera)
```

**P.S**

“Both of these scripts we’re made with Roblox’s new AI Assistant. If the codes wonky… You now know why.”

*Any help is much appreciated.*

Have a nice day!