I haven’t used Activated in a while so I can’t say when this started happening. Happens every time.
Reproduction: bug.rbxm (3.0 KB)
I haven’t used Activated in a while so I can’t say when this started happening. Happens every time.
Reproduction: bug.rbxm (3.0 KB)
isint the activated property set to false by default and set to activated while the signal is passing through,
wich would mean that setting it false would not have an effect unless its maybe done after the inital activation, (like a pres and hold cap).
No, you are wrong.
Each button object has a property called ‘Active’ that is used by the developer to control whether the button works or not. This works as intended for mouse and touch input, however when using a controller the button still detects an activation even if the Active property is disabled.
Try out the reproduction yourself and see what I mean.
This is correct. The property is so you can create, say a grayed out button while it’s processing something for example.
This issue has been a long running problem iirc, I just assumed it was an old abandoned feature that isn’t given support anymore (despite not being deprecated). All my scripts just use the normal button events and manually check if Activated is set to true or not, since this event in its current state isn’t even necessary.
Yeah, the Activated
Event has even more bugs than that, so I don’t use it.
An odd workaround: Parent a small cloned LocalScript
to each button. The script defines a function
that grabs the script.Parent
(the button object) where the function contains a call to a generic handler,
in some module, that takes the button object as an argument. In the small script, you connect the
function (that accesses the button object) as the listener for these events instead of Activated:
MouseButton1Click
(along w/ TouchTap
to work w/ UIPageLayout
)
(And distinguish the button by its object or an added child IntValue
, etc. in the generic handler.)
(And then do your own “active” check as @Xeptix suggests.)
As odd as it seems, this way you can be cross-platform and cross-controller compatible by
taking advantage of MouseButton1Click
, and still knowing which button was used,
and avoid the Activated Event bugs.
This isn’t the function of the Active property, despite the name. Active
controls whether the GuiObject in question sinks input for the 3D view. If you click on a button with Active set to false, a click detector on the screen underneath the button will also be clicked; if Active is true, it won’t be clicked. Something similar is true for ScrollingFrames: if Active is set to false, scrolling the scrolling frame will also scroll the 3D viewport; if it’s true, it won’t.
In the future we may deprecate this property and replace it with a more appropriately named variant but I can’t promise that it’ll happen, or when it would. Sorry for the confusion!
Can you please report the other issues you’re experiencing? We recommend using this event exclusively for detecting clicking/tapping/etc. on a button (MouseButton1Click’s behavior is deprecated and considered to be pretty non-idiomatic).
When I stress tested this, ~a year ago, I tested under multiple platforms and input devices, the Activated
Event simply wasn’t as rock-solid as using MouseButton1Click
& TouchTap
. I don’t have new testing for you.
My saying “so don’t use it” came across as a bit harsh, so I’ll fix that to read “so I don’t use it.”
The documentation page for GuiButton | Documentation - Roblox Creator Hub does
not state anywhere that the GuiButton.MouseButton1Click
Event is deprecated. Should it say so?
(Just to be clear, I do realize you said “behavior”, and have read this before, however until I see an actual
breaking change in the behavior or the event actually becomes deprecated, I will continue to use it.)
To be clear: the event itself is not deprecated, but the behavior where it responds to touch/gamepad events is. In the future we may phase this behavior out or provide an opt-in way to disable it. Generally, we want the mouse button events to only respond to mouse inputs; the fact that they handle touch/gamepad inputs as well is a legacy measure intended to make some games more accessible on touch devices. Activated is intended to be the cross-platform way to handle a simple “click/tap this button” event.