How can I know whether the mouse click on a active UI?

I bind attack action on left mouse button, but it still act when I clicking some active UI, which is not my needs.
So can I do some judge?

the script like:

local is = game:GetService(“UserInputService”)
local bind = is.InputBegan:Connect(function(inputob)
if inputob.UserInputType == Enum.UserInputType.MouseButton1 then

What I mean is I dont want do_attack when I click some UI buttons.

I have no idea what you are talking about could you please reword it better so it is easier to understand?

I added something.
Thank you for your attention

There is a argument passed through the InputBegan called gameProcessedEvent.

You can use it like this

UserInputService.InputBegan:Connect(function(input: InputObject, gameProcessedEvent: boolean)
    if gameProcessedEvent then return end
    -- Code

Game processed event is just a check whether or not the user is clicked a button or opened a menu etc. Usually you have this at the start of every UserInput action.

1 Like