Mouse.Button1Down/Button1Up doesn't fire when UI elements are in the way

I have these two simple functions:

Mouse.Button1Down:Connect(function()
	print("down")
end)
Mouse.Button1Up:Connect(function()
	print("up")
end)

This code does not fire when the mouse is hovering over UI elements such as frames, and full-screen GUIs.


This becomes an issue when the main HUD is a frame that scales across the entire screen ({1, 0, 1, 0}). Is there a workaround (or another function) to this issue?

Have you tried changing the ZIndex of the elements?

2 Likes

i dont think changing ZIndex of ui would help in this case… maybe in fact take advantage of the fact that its not clicking. instead just put in a text or image button inside the frame, scale the button to {1, 0, 1, 0} (the size of the frame), remove the image/text and background, and use the same code for the button. (make sure that the ZIndex of the button is prob > 1 so other stuff doesn’t interfere with it)

1 Like