Hey, I’m trying to make a mobile gui, where if you put your finger on the screen and then move it onto the gui (or another gui) it still detects it. Very similar to Minecraft Pocket Edition’s movement controls.
If you have one finger on the screen at a time it works just fine, but if you have 2 or more fingers on the screen at a time (such as just trying to press the gui and turn screen at the same time) it doesn’t do anything.
Its very hard to test for me, as I cant press 2 spots at the same time in studio. (only one mouse lol)
if you have any tips tell me! i believe the problem may be because it thinks the mouse position is either in between the 2 fingers or at the 2nd finger, but i cant tell. If theres a better way to accomplish this pls say!
Code:
while task.wait(0.05) do
--clear the input table before doing anything to reset inputs (may be the cause of the problem?)
table.clear(inputs)
--check if the mouse is down
if uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then
local x,y = mouse.X, mouse.Y
local objectsAtMouse = player.PlayerGui:GetGuiObjectsAtPosition(x, y)
--loop for every gui button in a frame
for i, button in pairs(script.Parent.controls:GetChildren()) do
if table.find(objectsAtMouse, button) then
--set the input in the table to true
inputs[button.Name]] = true
end
end
end
end