How to make UserInputService not detect chat

Im making an egg hatching system, and i am having a bug with userinputservice where when they are chatting when close to an egg, their inputs are still registered. how can i make their inputs not registered?

There are a few options:
A: Try using ContextActionService. It is similar to userinputservice that automatically deals with this.
B: There is a second argument known as a GameProcessedEvent of which you can utilize (this is a boolean, so you’ll want to check to see if that is true.

1 Like

Second argument of it will help:

local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function(input, gameProcessed)
    if gameProcessed then return end

	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		print("The left mouse button has been pressed!")
	end
end)
1 Like