They generally don’t work very well, here’s an example scenario:
You have a TextButton witha MouseButton1Click, MouseEnter and MouseLeave function.
MouseEnter makes the TextButton.BackgroundTransparency 0.5
MouseLeave resets the TextButton.BackgroundTransparency to 0
MouseButton1Click prints “hi”
You hover over the TextButton, it’ll already give strange, random results after repeating this process a few times.
You hover over the TextButton, then click while on it.
it prints “hi”
You move away from the TextButton, it resets fine.
You click fast, and while clicking and holding the mouse button down you hover outside the TextButton, firing MouseButton1Click but not MouseLeave, causing very unwanted results.
-- Local script
local ui = script.Parent
ui.MouseEnter:connect(function()
ui.BackgroundTransparency = 0.5
end)
ui.MouseLeave:connect(function()
ui.BackgroundTransparency = 0
end)
ui.MouseButton1Click:connect(function()
print("Hi")
end)