I have a gui button that only appears on mobile, and while testing I noticed it often gets activated by dragging over it to adjust the camera. here is an example:
as you can see, when I drag my mouse over the button it activates, and the same thing happens on mobile. I do not want this to happen, how can I make the button only activate when pressed, not when dragged over?
I am actually using this custom replacement for ContextActionService, (here is a Link!) I looked through it and it does not use mouse button down or mouse button click, as it is a server sided module. I am gonna try to modify it so that it does use click, but if I remember correctly click only fires when you press down and release. This will cut down on the false positives, but I do not think it will fully eliminate them as there is still a chance someone drags onto it and releases on it as well. Plus, I use user input began and end in the script for denounce and to make it change color when the input begins, won’t using mouse button click affect this and make it only fire once, on user input end?
The problem is that when the player drags onto it their mouse position is on it, even though before it was not. The problem I’m getting is not that it fires while dragging, it’s that when adjusting your camera on mobile you often drag into it, which causes it to fire.
local UIS = game:GetService("UserInputService")
local button = script.Parent
button.MouseButton1Click:Connect(function()
if UIS.TouchEnabled then --end function if player is on a touchscreen device
return
end
--perform normal button action here when mouse clicked and released
end)
button.TouchTap:Connect(function()
--perform normal button action here when screen is tapped and released
end)