Hello, I’m wondering if UserInputType has/will have an index associated with TouchTap. I tried using it in game didn’t work, looked it up both on Roblox wiki and the devForum but there wasn’t anything related to it. I was hoping to be able to shorten codes by using it like this.
--// Ins = Instance_Object
local Potion_Activated = function() --// Preferences
--// Detect player input when pressing Gui on computer(On by default).
for Id, Sizes in pairs(Gui_PotionList) do
for SizeType, Ins in pairs(Sizes) do
Ins.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
local Id , SizeType = Id, SizeType
--foo()
end
end)
end
end
--// Detect when player TouchTap on a TouchEnabled device
if UserInputService.TouchEnabled then
for Id, Sizes in pairs(Gui_PotionList) do
for SizeType, Ins in pairs(Sizes) do
Ins.TouchTap:Connect(function(input)
--foo()
end)
end
end
end
end
--// vs
local Potion_Activated = function()
--// Attach events
local IterateOverFolder = function(Folder, InputType)
for SizeType, Ins in pairs(Folder) do
Ins.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType[InputType] then
--foo()
end
end)
end
end
--// Detect player input when pressing Gui on computer(On by default).
for Id,Sizes in pairs(Gui_PotionList) do
for SizeType,Ins in pairs(Sizes) do
IterateOverFolder(Sizes, "MouseButton1")
end
end
--// Detect when player TouchTap on a TouchEnabled device
if UserInputService.TouchEnabled then
for Id,Sizes in pairs(Gui_PotionList) do
IterateOverFolder(Sizes, "TouchTap")
end
end
end
Edit: Seems like if it was decided that UserInputType would have a TouchTap, then others like TouchPan or TouchPinch would have to be added, that’d be a lot of work.