InputBegan Behaviour Change [RobloxCritical]

There has been an unexpected behaviour change with the InputBegan event.

When I click a brick containing a ClickDetector, and handle this click using UserInputService.InputBegan in a LocalScript, the second argument “gameProcessedEvent” is true whereas it always used to be false. I’m not entirely sure what the bool gameProcessedEvent is meant to signify but I always used to check the property was false in order to make sure the player wasn’t clicking on a gui or something.

It has broken customer interaction in Restaurant tycoon because my code doesn’t run anymore. It has reduced the average visit time on PC for restaurant tycoon from around 22 minutes to about 9 minutes. However, visit times on mobile have stayed the same, so I think the issue only happens if the UserInputType is MouseButton1.

This bug started happening about 14 hours ago. (judging my by place statistics)

This bug can be recreated by inserting a brick into workspace containing a clickdetector and inserting a localscript with the following code:

game:GetService(“UserInputService”).InputBegan:connect(function(inputObject,gameProcessedEvent)
print(tostring(gameProcessedEvent))
end)

(it will print true but before it would have printed false)

Thanks.

1 Like

I believe the bool is for determining that some other script hasn’t already processed that input. E.G The chat window being open would make this true for any keystrokes.
What are the cases where the bool would be true for MouseButton1 and you would not want to process the input?

Maybe if they click the chat bar or through another gui?

Yeah, i could just remove the check to fix the issue. But it might have broken other games. And it seems to be behaving differently on mobile than on PC so i think roblox might wanna check the issue.

This would be problematic for various features. For instance, if I have an ability that allows the player to shoot fireballs, I don’t want them to accidentally shoot one when they click the chat window, but I want them to be able to fire even if their cursor is over a lever that has a click detector in it (and not fire Clicked on the ClickDetector)

This would be alleviated by being able to disable all ClickDetectors when using this ability or similar features, but that’s not trivial to do ATM.

1 Like

Yeah, exactly, So when clicking a ClickDetector gameProcessedEvent should definitely be false.

gameProcessedEvent being true is correct behavior because the game has processed the input already. The correct approach would be to disable click detectors when they can’t be used.

Doesn’t that mean that gameProcessedEvent should be false? (Because you want to run the code to fire the weapon??)

No, gameProcessedEvent is set based on what actually happened – not what you want to happen. It would be true when processed by ClickDetectors, and false when ClickDetectors are disabled because the click was never processed.

Disabled/Enabled are not a property of ClickDetectors though? (…mistake me if i’m wrong)

But I need the ClickDetector to be there in order to change the mouse icon when the player hovers over it.

Yes, the request is to make that easy to do:


Why are you listening for mouse clicks where you’d both process the ClickDetector and process another click event?

I’m not listening for MouseClick i’m only listening for InputBegan.

What are you doing on InputBegan?

It just handles the customers in the restaurant e.g. serving them, bringing them to tables, etc. It’s way easier than doing MouseClick.

The ClickDetectors aren’t useful at all except for changing the mouse’s icon.

Regarding disabling click detectors, for now you can just set the max distance to 0.

Moreover, the Mouse object already has an icon property.

So you’re using ClickDetectors to set icons for actions you handle on InputBegan?

Yeah

Why are you mixing them instead of:

  • Using ClickDetector.MouseClick to process those actions instead of InputBegan so the entire system is handled by ClickDetectors

  • Setting the mouse icon manually based on mouse target so the whole system is contained to input services

  1. For the first one it’s because I’d like to handle the click on the client.
  2. To save me a bit of work

I guess I will just remove the if-statement for gameProcessedEvent to fix my game for now.

But the bug is still an issue because it has different behavior on Mobile / PC. On mobile, gameProcessedEvent is still false, working in the same way it has always done.

You can listen to MouseClick from the client

Yes, needs to be addresses and is valid ROBLOXCRITICAL bug. Eliciting feedback so Roblox can implement a more appropriate behavior with sufficient notice.

Oh it says on the wiki that

"The MouseClick event must be handled by a Script. "