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)
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.