--[[local camera = workspace.Camera

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

game:GetService("RunService").RenderStepped:Connect(function()
	local rx, ry, rz = camera.CFrame:ToOrientation()
	ry = math.rad( math.clamp(math.deg(ry), -60, 60) )
	
	if humanoid.Sit == true then
		camera.CFrame = camera.CFrame:Lerp(CFrame.new(character.PrimaryPart.Position) *
			CFrame.Angles(0, ry, 0) * -- limited Y rotation
			CFrame.Angles(rx, 0, rz), 0.3) -- retain X and Z rotation
	end
end)]]
--

local camera = workspace.Camera

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local humanoid = character:WaitForChild("Humanoid")

game:GetService("RunService").RenderStepped:Connect(function()
	local rx, ry, rz = camera.CFrame:ToOrientation()
	ry = math.rad( math.clamp(math.deg(ry), -60, 60) )

	if humanoid.Sit == true then
		camera.CFrame = camera.CFrame:Lerp(CFrame.new(character.PrimaryPart.Position) *
			CFrame.Angles(0, ry, 0) * CFrame.Angles(rx, 0, rz), 0.3) -- limited Y rotation
	end
end)
