local ScreenGui = script.Parent
local ImageButton1 = ScreenGui.ImageButton1
local ViewportFrame = ImageButton1.ViewportFrame

local Camera = Instance.new("Camera")
Camera.Parent = ViewportFrame

ViewportFrame.CurrentCamera = Camera


local Part = ViewportFrame.Part

local ButtonDown  = false

local OldX = 0
local OldY = 0
local Z = 5


local Mouse = game.Players.LocalPlayer:GetMouse()




ScreenGui.ImageButton1.MouseButton1Down:Connect(function()
			
	ButtonDown = true
	
	OldX = Mouse.X
	OldY = Mouse.Y
	
end)


ScreenGui.ImageButton1.MouseButton1Up:Connect(function()

	ButtonDown = false
	
	
end)




local iX = 0
local iY = 0

Mouse.Move:Connect(function()
	
	
	if ButtonDown then
		--Left or X
		if Mouse.X < OldX then
			Camera.CFrame = Part.CFrame  *CFrame.Angles(0,iX,0) * CFrame.new(0,0,5) 
			iX = iX + math.rad(5)
		end
		
	end
	
	if ButtonDown then
		if Mouse.Y < OldY then
			Camera.CFrame = Part.CFrame *CFrame.Angles(iY,0,0) * CFrame.new(0,0,5) 
			iY = iY + math.rad(5)

		end
	end
	
	
end)

It keeps resetting and i was wondering if the error came from

			Camera.CFrame = Part.CFrame  *CFrame.Angles(0,iX,0) * CFrame.new(0,0,5) 
			
and

			Camera.CFrame = Part.CFrame *CFrame.Angles(iY,0,0) * CFrame.new(0,0,5) 

Does anyone know how I can replace CFrame.Angles(0, x ,0) to a normal value so it dosent reset everytime