TouchPan doesnt change state to End

Hey… I want to use TouchPan as a form of TouchHold, however the input state never becomes End?

game.Players.LocalPlayer.PlayerGui:WaitForChild("GameUI").MobileUI.ShootButton2.TouchPan:Connect(function(pos,translate,vel,state)
	print(state)
	if Enum.UserInputState.Begin == state and not dragging2 then
		dragging2 = true
		basePosition2 = game.Players.LocalPlayer.PlayerGui:WaitForChild("GameUI").MobileUI.ShootButton2.Position
		startTouchPosition2 = pos[1]
		shootingMobile("Down")	
	elseif Enum.UserInputState.End == state and dragging2 then
		shootingMobile("Up")
		dragging2 = false
		game.Players.LocalPlayer.PlayerGui:WaitForChild("GameUI").MobileUI.ShootButton2.Position = truePosition2
	elseif Enum.UserInputState.Change == state then
		local touchPosition = pos[1]
		local deltaPosition = UDim2.new(
			0, touchPosition.X - startTouchPosition2.X,
			0, touchPosition.Y - startTouchPosition2.Y
		)
		game.Players.LocalPlayer.PlayerGui:WaitForChild("GameUI").MobileUI.ShootButton2.Position = basePosition2 + deltaPosition
	end
end)

what this code essentially does is it moves a button around and (should) snaps it back to place when you let go. however, the Enum.UserInputState.End never happens, it starts with Begin and then spams Change until I let go when it stops entirely… how would I know when it ended?

Can you test this in a live game?
The developer hub states that “This event cannot be simulated in Studio using the emulator and a mouse; you must have a real touch enabled device to fire this event.”
GuiObject.TouchPan (roblox.com)

I have, I’m using my phone to test this (iPhone X)

Does it also only fail with Buttons, have you tried this with say a Label or Image or something other?

Its been a long while since I work with UI, does the ‘Active’ property have any impact on this as well?

I haven’t tested it with anything that isnt a button, the active property is on, I tried checking it off but that just made it not work at all…

EDIT:
I just tested with a frame instead, still the same results.

Sounds like its just a bug then.

Not sure if you can change the category or if you’ll need to create a new topic as a Bug Report.

I cant create bug reports…
you can only create one as a regular forum member

I can only create Forum Bugs apparently.
Well that’s annoying.

yeah same as me…
you can’t create an engine bug post?

Used to be able to, but for an unknown reason that Support haven’t bothered getting back to me about, I can not longer create them.
Don’t when that changes or why, just the case now.

1 Like