TouchPan exit not working (UserInputState.End)

Hi!
I’m having trouble with the exit of the TouchPan event on GuiObjects.

local frame = script.Parent

local function onpan(touchPositions, totalTranslation, touchVelocity, state)
	if state.Name == "Begin" then
		print("touch begin")
	elseif state.Name == "Changed" then
		print("touch changed")
	elseif state.Name == "End" then --problem
		print("touch end")
	end
end

frame.TouchPan:connect(onpan)

The last UserInputState isn’t being fired for some reason.
I’m hoping someone can help me out.
Thanks in advance!

Edit: I came across a solution using another event. InputEnded.

local function oninputended(io)
	if io.UserInputType.Name == "Touch" then
		print("touch end")
	end
end

frame.TouchPan:connect(onpan)
frame.InputEnded:connect(oninputended)

However, i’d like to see if you guys have a solution for the last statement in the onpan function not being detected.

A debounce to detect when its panning or not might fix this.

You could also try comparing the state directly with the enum, instead of the name.

(e.g. if state == Enum.UserInputState.End then)

This is the code provided on the Wiki page.
It uses enums and a debouncer.
Still, it doesn’t work for me.

Did you happen to mess with the properties of the Frames, such as the Active property? That property should be unchecked for innerFrame.

I inserted two new frames into an empty ScreenGui and ran the code, worked fine for me.

Tried again with two new frames.
innerFrame had the Active property set to false and outerFrame had the Active property set to true.
Still, doesn’t work for me.

That’s really odd, and there’s no other Frame/GUI element in the ScreenGUI, just those two? If so, this issue might be specific to your device. If you didn’t already, I would try this in a new empty baseplate just to confirm.

I have tried on an empty baseplate and on different devices. Still getting the same issue.
The Enum.UserInputState.End isn’t being fired for me.

If that’s the case then you’ll probably want to file a bug report. What devices did you test on?

iPhone, Samsung and Xperia devices have been tested by me.