ScrollingFrame.InputEnded fires when scrolling with Touch

I want to detect when a user releases their finger from a ScrollingFrame so that my script can gravitate the ScrollingFrame toward an object within the ScrollingFrame. The problem is that ScrollingFrame.InputEnded fires as soon as the user scrolls the ScrollingFrame.

The only solution I can think of is to use UserInputService.InputBegan with Input.Position and Input.UserInputType to check if the user is touching the ScrollingFrame, then wait for UserInputService.InputEnded to fire my ‘gravitate’ function. I’d also have to appropriately use :Disconnect() to make sure it’s not firing for every touch.

Put this script in a ScrollingFrame to replicate this problem.

local UIS = game:GetService("UserInputService")
script.Parent.InputEnded:Connect(function()
	print("ScrollingFrame.InputEnded")
end)
UIS.InputEnded:Connect(function()
	print("UserInputService.InputEnded")
end)