Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Custom TouchButton on Roblox Mobile Can't be pressed on multi touch?

Asked by
Dfzoz 489 Moderation Voter
4 years ago

I have been creating a bomberman game and decided to finally make some mobile controls for it. I added some code to check if the player is on a mobile device and if true then it connects functions to the buttons, else, it destroys them. I know they worked because I can see them and Touch works. The problem is that when I hold the walking button the buttons I created can't be activated. Any Idea why this happens? I know my mobile device can do multi touchs because in other apps it sure can! Here is the code for the Touch event:

local UIS = game:GetService("UserInputService")
local GuiService = game:GetService("GuiService")
if UIS.TouchEnabled and not UIS.KeyboardEnabled and not UIS.MouseEnabled and not UIS.GamepadEnabled and not GuiService:IsTenFootInterface() then--Checks if mobile
    script.Parent.TouchButtons.Place.TouchTap:Connect(function() game.ReplicatedStorage.Events.CreateBomb:FireServer(char.HumanoidRootPart.Position+Vector3.new(0,5,0)) end)--BindtoTouch
    script.Parent.TouchButtons.Explode.TouchTap:Connect(function() game.ReplicatedStorage.Events.RemoteExplode:FireServer() end)--BindtoTouch
else script.Parent.TouchButtons:Destroy()--If not mobile, destroy the buttons
end

Also, thinking the problem was that somehow Roblox movement TouchPad GUI would get a higher ZIndex when touching them, I have set my buttons ZIndex to 10 to see if it would fix the problem and it didn't.

0
The walking controls - are they in a ScreenGui with DisplayOrder greater than the DisplayOrder of the ScreenGui containing your buttons? If that doesn't get you anywhere, have you tried using other events (like TouchPinch/Rotate/Pan)? Does InputBegan fire? chess123mate 5873 — 4y
0
Well. The displayorder and touchpan/rotate/pink didnt work. Now the InputBegan works, but if I star the touch outside the button and drag the finger into it it presses it too, like a mouseentered event, which i dont want to. Still better than no multitouch, though Dfzoz 489 — 4y

Answer this question