How to detect when GUI button is being pressed down/released?

Hello
What is the best way to detect when the user pressed down /releases GUI button with the Mouse or starts touching/releases the touch on the same GUI button?
(I want to filter the cases when the user simply hovers over the button with the mouse)

Thanks

You could use MouseButton1Click and MouseButton1Up to detect if the player has pressed or released the mouse click

Local Script

local gui = script.Parent
local TextButton = gui.TextButton

TextButton.MouseButton1Click:Connect(function()
	
end)

TextButton.MouseButton1Up:Connect(function()
	
end)
2 Likes