** Which is better?**
Button.Enabled Or Button.MouseButton1Down
Does Button.Activated work client-side?
Why would I use .MouseButton1Down over .Activated?
Why would I use .Activated over .MouseButton1Down?
** Which is better?**
Button.Enabled Or Button.MouseButton1Down
Does Button.Activated work client-side?
Why would I use .MouseButton1Down over .Activated?
Why would I use .Activated over .MouseButton1Down?
There are likely more reasons than what I mention below for using one or the other, but here’s a comparison of the two based on what I can recall and what is included on the Roblox Creator Documentation site:
Only allowed to fire when the Active
property is enabled, allowing you to decide when a button press should be ignored.
Fires once the button has been fully activated (as in, the player has pressed the button and let go of it).
Returns the inputObject that was used to activate the button (and also how many times the button was clicked in a row). Can be referenced to easily check a variety of things, including the UserInputType (such as MouseButton1, Touch, Gamepad1, etc.).
Fires immediately once the GuiButton is pressed. Does not wait for the user to let go of the button.
Returns the X and Y coordinate on the screen where the mouse cursor was at the time the event fired.
Both events work on the client, as it’s meant to be used with UI, after all.
Generally, the more common comparison I see is between Activated
and MouseButton1Click
because their behaviors are more similar to one another than Activated
and MouseButton1Down
.
Unfortunately, because there’s essentially no documentation for Activated
at the moment, it can be difficult to verify some of the specifics about how it works / what could make it better or worse than the other options.
Personally, I’ve opted toward using Activated
over the other options ever since hearing the sentiment that it’s a better choice for supporting multiple types of inputs (e.g. mouse, touch, controller), which most likely stems from how it returns the inputObject.
Additionally, because it doesn’t mention a specific device in the event name like the MouseButton...
events do, it felt “safer” to use when wanting to be compatible with multiple input types (although I’m pretty sure that each of MouseButton1Click
, MouseButton1Down
, etc. work fairly consistently for multiple types of inputs).
If anyone has any additional information to provide and / or corrections to make for anything I’ve mentioned, feel free to chime in!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.