How do i make a mouse delta not teleport the camera

im trying to make a rts game and i need some help, i use a custom mouse delta that works whitout the need for mouse lock to make the camera pan system, i have to use vector3 due to the camera parts slight angle, when i press the button to pan the camera the camera telports to a random place how do i fix this

the function to update the camera

local function UpdateCamera()
	
	local Pos = Vector2.new(mouse.X / sensitivity,mouse.Y / sensitivity)

	local Delta = Pos - (Prev or Vector2.new()) + uis:GetMouseDelta()

	print(Delta)
	
	CameraPart.Position = CameraPart.Position + Vector3.new(-Delta.X, 0, -Delta.Y)
	
	Prev = Pos
	
	
end

i would be thankful if anyone could help