When connecting to a GuiButton.Activated
event, the clickCount
parameter passed to the callback should represent the number of consecutive clicks on the respective button.
This is useful for detecting double clicks and anything of the sort, but this parameter is always 0
when using touch inputs (like on mobile and tablet) or a controller.
Here is a simple script to demonstrate this behavior, including a video of each of the input methods:
button.Activated:Connect(function(inputObject, clickCount)
print("Activated! Click count:", clickCount)
end)
Touch input
I have tested this on a phone as well, and the behavior is the same as in the Studio emulator.
Controller input
The same behavior happens with the virtual mouse cursor disabled.
System information
OS: Windows 10 (Version 10.0.19045 Build 19045)
CPU: AMD Ryzen 7 5800X 8-Core Processor
RAM: 32GB
GPU: NVIDIA GeForce GTX 1060 6GB
Place file
This is the place I tested in:
GuiButtonActivatedIssue.rbxl (41.6 KB)
Expected behavior
The mouse input presents the correct behavior, with the clickCount
increasing as the button is clicked, and going back to 0 after a certain amount of time passes with no clicks: