[100% Repro] Cannot click on SurfaceGui while using ContextActionService

Description
The bug makes it so that you cannot click on SurfaceGui elements while using ContextActionService. The bug occurs whenever you use ContextActionService in order to easily get cross platform support for a reusable action for your game.

Where it happened
The bug first occurred as I was trying to script a board of dev products for my game for which I needed to use ContextActionService for. It made it so that I could not click on any SurfaceGui element while using ContextActionService. Found the bug through debugging, might be caused due to how it’s implemented internally (priority over other actions such as MouseButtonClick, which I used for my SurfaceGuis)

When it started happening
It started happening when I implanted SurfaceGui for my game while using ContextActionService.

** Screen shots of the bug**
With ContextActionService:

Withut ContextActionService:

Reproduction steps

  1. Set up a context action service action bind to a users mouse click.
  2. Set up and place a GuiButton in a StarterGui in a SurfaceGui (make its adornee be a part in workspace)

Place file: ContextActionBug.rbxl (22.9 KB)

System specs
Doubt if it has anything to do with hardware (can be reproduced 100%) but I will provide if needed.

1 Like

Thanks for the report!

The behavior you are seeing is because the ContextActionService action is handling the event, so it doesn’t get passed to the button click event. This is by design. In order to allow others to process the event as well, you may add this to the end of your ClickBind function:

return Enum.ContextActionResult.Pass

You can read more here:
https://developer.roblox.com/en-us/api-reference/enum/ContextActionResult

6 Likes

Alright, thought this was a problem but it seems like it’s made so by design. :smiley: Thank you for the quick response!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.