Description:
When a part with a ClickDetector is put over a HandleAdornment (with AlwaysOnTop = false), say ImageHandleAdornment, then all clickdetector events will function as expected apart from ClickDetector.MouseClick. This event will not trigger when the player is clicking on the area of the part that overlaps with the HandleAdornment behind it.
When a part with a ClickDetector is put underneath the ImageHandleAdornment, then all ClickDetector events will still trigger apart from MouseClick.
Expected behaviour:
The expected behaviour, in both cases, is that all events are treated consistently: either all events are blocked from executing or all events are passed through to the ClickDetector, MouseClick shouldn’t be the odd one out. Especially when the HandleAdornment is underneath the part in terms of view space, all events should be passed through. I would suggest to let all events pass through instead of blocking them, because this is most flexible for developers.
Repro file:
ImageHandleAdornment_ClickDetector_Bug_Repro.rbxl (13.5 KB)
There is some code in workspace.Part that prints the events of the clickdetector. Furthermore there are two ImageHandleAdornments in game.StarterGui with workspace.Part set as the Adornee, with different offsets.
Repro walkthrough - Part 1
Open the repro file and start “Play” mode. Subsequently, mouse-over and interact with the part in front of your character and watch the output for event messages of the ClickDetector.
Clicking on the outside area of the underlying ImageHandleAdornment will trigger the MouseClick event:
Clicking on the inside area w.r.t. the underlying ImageHandleAdornment will not trigger the MouseClick event:
Notice that all other events (MouseHoverEnter, MouseHoverLeave, RightMouseClick) have the expected functionality and therefore trigger output messages at the right moments, not just depending on whether you’re hovering over area covered by the underlying ImageHandleAdornment.
Repro walkthrough: Part 2
Continuing from the previous part, run the following code in the command bar:
game.StarterGui.White2.Visible = true
We now have the following situation:
Try to interact with the brick through the ImageHandleAdornment (i.e. mouse-over and left/right-click on the area of the brick covered by the ImageHandleAdornment in front of it). All events still work apart from MouseClick.
Additional notes:
This bug occurs in any game and in Studio, 100% of the time, Studio version 0.288.0.118399 (but this has probably been this way ever since HandleAdornments were added). I’m on Windows 10 Pro, if that matters.