Gui button clickable from EVERYWHERE

HELLO


I have these 2 buttons. One of them actives by hitting the key “F” and the other one activates by “G”.
In mobile we just click on them.
Problem is on mobile, where ever I click on, both buttons activate. They activate even if I don’t tap on them.

this is the script responsible for mobile click handling
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
	if UserInputService.TouchEnabled and not gameProcessedEvent then --is it mobile
		PerformActions() --does my stuff
	end
end)

Is it about the script or anythings else? Please help

Further info

hierarchy:
image
hitboxes:
image

That function you have will fire whenever you do any input. Just add a connection to that button that fires whenever you MouseButton1Down on it.

Code:

button.MouseButton1Down:Connect(function()
	PerformActions()
end)

(MouseButton1Down fires for both PC and mobile)

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.