Help Needed: Fixing First-Person Camera Glitch When Looking Down

I’m experiencing an issue with my first-person camera setup in Roblox. Whenever my character looks all the way down and starts walking, the camera glitches. It appears to either flip my avatar or the camera itself, resulting in a disorienting visual effect.

Has anyone encountered this problem before? What can I do to fix it?

Thanks in advance for your help!

1 Like

Could you provide the script???

local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local HRP = character:WaitForChild("HumanoidRootPart")

humanoid.WalkSpeed = 8

local RNS = game:GetService("RunService")
local uis = game:GetService("UserInputService")

-- Camera settings
player.CameraMaxZoomDistance = 0.5 -- Force first person
camera.FieldOfView = 100
uis.MouseIconEnabled = false

-- Disable CameraOffset
humanoid.CameraOffset = Vector3.new(0, 0, -1.5)

-- Keep every body part transparency to its real transparency
for _, child in pairs(character:GetChildren()) do
	if child:IsA("BasePart") and child.Name ~= "Head" then
		child:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
			child.LocalTransparencyModifier = child.Transparency
		end)
		child.LocalTransparencyModifier = child.Transparency
	end
end

-- If the player steps in a vehicle
camera:GetPropertyChangedSignal("CameraSubject"):Connect(function()
	if camera.CameraSubject:IsA("VehicleSeat") then
		camera.CameraSubject = humanoid
	end
end)

-- Camera bobbing settings
local rotFrequency, rotIntensity = 4.6, 1.35 -- Camera rotation on z axis (frequency is how fast, intensity is how strong)
local verFrequency, verIntensity = 8.35, 0.25 -- Camera movement on y axis (frequency is how fast, intensity is how strong)
local defWalkSpeed = 20.3 -- Default walk speed (so that whenever the walk speed increases, the walk bob gets faster)

local previousVelocity = nil

local function Lerp(a, b, t)
	return a + (b - a) * t
end

local function GetCurve(frequency, intensity)
	return math.sin(os.clock() * frequency) * intensity
end

RNS.RenderStepped:Connect(function()
	local velocity = math.round(Vector3.new(HRP.AssemblyLinearVelocity.X, 0, HRP.AssemblyLinearVelocity.Z).Magnitude)
	if previousVelocity then
		velocity = Lerp(previousVelocity, velocity, 0.25)
	end
	previousVelocity = velocity

	camera.CFrame *= CFrame.new(0, GetCurve(verFrequency, verIntensity) * velocity / defWalkSpeed, 0) * CFrame.Angles(0, 0, math.rad(GetCurve(rotFrequency, rotIntensity) * velocity / defWalkSpeed))
end)

You probably want to change the system to save the vertical rotation and horizontal rotation, then add the velocity and clamp the vertical rotation between -(0.49* math.pi) and (0.49 * math.pi), which stops the camera from going too far below and too far up. Set the CFrame so you can restrain it, instead of multiplying the previous CFrame.