UIS.TouchStarted:Connect(function(_, proc)
if proc then return end
if chara:FindFirstChildOfClass('Tool') then chara:FindFirstChildOfClass('Tool'):Activate() end
end)
This successfully filters out GUI items like chat or jump button but fails to filter out the joystick GUI, besides I can’t find a way to filter out mobile swipes. I tried to search a lot on devforum but found no solutions so far
So to use mobile swipe you could do something like this:
local UserInputService = game:GetService("UserInputService")
local char = script.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
UserInputService.InputChanged:connect(function(input, processed)
if input.KeyCode == Enum.SwipeDirection.Up then -- Change this to up, down, left or right the
for i, v in pairs(char:GetChildren()) do
if v.ClassName == "Tool" then
v.Enabled = false
end
end
end
end)
this would be a local script in startercharacterscripts. I hope this was informative as well helpful at the same time.
Ah so it’s basically Enum.SwipeDirection, Thanks alot for that! Here is how I did it
if UIS.TouchEnabled then
UIS.TouchStarted:Connect(function(inp, processed)
if processed then return end
if table.find(Enum.SwipeDirection:GetEnumItems(), inp.KeyCode) then return end
local tool = getCurrentTool()
if tool then tool:Activate() end
end)
UIS.TouchEnded:Connect(function(_, processed)
local tool = getCurrentTool()
if tool then tool:Deactivate() end
end)
end
EDIT Fixed the code, Enum.SwipeDirection*:GetEnumItems()*