SurfaceGui buttons not detecting TouchTap

Hello, I have a billboard GUI and it has buttons in it, I am trying to add mobile support to this but TouchTap doesn’t run. Any way of fixing this?

Here’s my current code:
(PC works and prints, Mobile does not)

if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled and not UserInputService.MouseEnabled then -- Mobile
				v.TouchTap:Connect(function()
					print("Mobile!")
					onButtonPress(v)
				end)
			elseif not UserInputService.TouchEnabled and UserInputService.KeyboardEnabled and UserInputService.MouseEnabled then -- PC
				v.MouseButton1Click:Connect(function()
					print("PC!")
					onButtonPress(v)
				end)
			end

Did you debug it? Print out what v is to make sure it is your button.

It is. It works on PC but mobile won’t even print anything, v is because this is inside an for i, v in pairs() loop

How are you testing the TouchTap? I am pretty sure you can’t test it on PC

Well, at first I didn’t think you could but I changed my screentype to a mobile type and also made another script detecting PC or mobile and it printed mobile when I had it like that

if UserInputService.TouchEnabled and not UserInputService.KeyboardEnabled and not UserInputService.MouseEnabled then -- Mobile
	print("Mobile")
elseif not UserInputService.TouchEnabled and UserInputService.KeyboardEnabled and UserInputService.MouseEnabled then -- PC
	print("Pc")
end

image

Yes but, it still won’t detect TouchTap

I tested it on normal GUI’s and it detects it, just not on a billboard GUI

1 Like

Surface gui** not a billboard gui, my bad.

Alright, got a fix. Made a surface GUI inside of StarterGui and will just control it all there instead

1 Like