Touchpan Not Working in Roblox Studio Mobile Emulator

if UIS.TouchEnabled then
local dragging
local currentPercent
connect1 = GuiTransparencyMove.TouchPan:Connect(function(touchPositions, totalTranslation, velocity, state)
local maxSize = Frame_2.AbsoluteSize
print(maxSize)
if state == Enum.UserInputState.Begin and not dragging then
print(“2”)
dragging = true
currentPercent = GuiTransparencyBar.Size.X.Scale/Frame_2.Size.X.Scale
GuiTransparencyMove.ImageTransparency = .4
elseif state == Enum.UserInputState.Change then
local increase = totalTranslation.X/maxSize
print(increase)
local newSize = currentPercent*Frame_2.Size.X.Scale+increase
if newSize > Frame_2.Size.X.Scale then
newSize = 1
elseif newSize < 0 then
newSize = 0
end
currentPercent = newSize
GuiTransparencyBar.Size = UDim2.new(newSize,0,.12,0)
GuiTransparencyMove.Position = UDim2.new((newSize-.035+.33),0,.389,0)
elseif state == Enum.UserInputState.End and dragging then
dragging = false
GuiTransparencyMove.ImageTransparency = 0
PlayersShownTxt_2.Text = string.sub(tostring(currentPercent),1,4)
ChangeGuiTransparencyFunction(currentPercent)
ChangeGuiTransparency:FireServer(currentPercent)
end
end)
end

When I run this script, and then use the roblox studio emulator to move the button across the screen, it doesn’t fire any of the prints.

Does touchpan not happen in Studio, or am I just doing something wrong?

6 Likes

Still having this same issue and no response. Any help?

1 Like

Idk if this will work or if i’m right but when you start the game the if statement will run 1 time because it isn’t in a loop. try adding

while UIS.TouchDisabled (if that’s a function, if not do: while true do) do
wait()
– put all your code here
end

1 Like

This is running on a ScreenGUI on a local script.
I still have no idea why touchpan doesn’t want to work

1 Like

Still needs help. I haven’t been able to implement this because of the problem.

1 Like

Have you tried to see if it works on actual mobile devices?

1 Like

It works only if GUI Active property is true

1 Like