Weird Camera/Input issues when mouse locked

--< Services >--
local Workspace = game:GetService("Workspace")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")

--< Constants >--
local SENSITIVITY = Vector2.new(1 / 250, 1 / 250)
local MIN_Y, MAX_Y = math.rad(-80), math.rad(80)

--< Variables >--
local Player = Players.LocalPlayer
local Camera = Workspace.CurrentCamera

local AngleX, AngleY = 0, 0

--< Functions >--
local function OnInputChanged(input, processed)
	if processed then return end
	
	AngleX = (AngleX - input.Delta.X * SENSITIVITY.X) % (math.pi * 2)
	AngleY = math.clamp(AngleY - input.Delta.Y * SENSITIVITY.Y, MIN_Y, MAX_Y)
end

local function Update(dt)
	local Character = Player.Character
	if Character then
		local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
		
		if HumanoidRootPart then
			local Attachment = HumanoidRootPart:FindFirstChild("CameraAttachment")
			
			if Attachment then
				HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position) * CFrame.Angles(0, math.rad(AngleX), 0)

				Camera.CFrame = CFrame.new(Attachment.WorldPosition) * CFrame.Angles(0, AngleX, 0) * CFrame.Angles(AngleY, 0, 0) 
			end
		end
	end
end

--< Initialize >--
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

--< Connections >--
UserInputService.InputChanged:Connect(OnInputChanged)
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value, Update)

I am running into a weird issue where the camera drifts upwards only when the mouse is locked to the center. I will be moving my mouse only horizontally yet input.Delta.Y not close to 0. I don’t know what could be causing this.

EDIT: Turns out this only happens in studio.

What do you want to achieve/Why the code was made?

The code is for a camera, it’s in the title.

https://gyazo.com/dd500a66f41a06686d01ad2ea28b5f56

Here is a GIF of the problem, I am only moving my mouse horizontally (except in the middle of the gif where I brought my mouse down).