UIS Touch functions running when I press game buttons

I’m currently developing a 2D game, and need to create a custom camera script. So far, I’ve created custom camera zooming using UIS.TouchPinch. However, it’s very buggy. For example, if I have one finger on the thumbstick and one finger on the jump button, and I move my fingers, it registers the movement as pinching. I want the custom camera system to work the same way as the default roblox camera script, so what I’m trying to do is to figure out how to not detect pinching when your finger is on a button.

So far as somewhat of a solution, I’ve made it so that you can only zoom if your character isn’t moving. However, it still feels somewhat janky, and I want the player to be able to zoom in/out while moving.

Section of my custom camera script

if UIS.TouchEnabled then
	local lastTouchScale = 0
	UIS.TouchPinch:Connect(function(_touchPositions, scale, _velocity, state, gpe)
		--TODO: find an alternative to prevent running when fingers are on the thumbstick, instead of hum.move
		if gpe or Humanoid.MoveDirection ~= Vector3.zero then return end
		if state == Enum.UserInputState.Change or state == Enum.UserInputState.End then
			local difference = 1 + lastTouchScale - scale
			zoomValue.Value = zoom*difference
		end
		lastTouchScale = scale
	end)
end