What does Userinputservice GPE do?

Hey I’m currently using Game:GetService(“UserInputService”)

True = clicked on GUI
False = clicked 3D world


I thought that GPE for userinputservice told you whether you clicked on a GUI or not vs the 3D world; However, for some reason it only returns true when they click on a button.


I want to be able to detect whether they click in the 3D world vs a 2D menu because I want my GUI to close only when they click outside of it (eg the 3D world)

Why does GPE only give false when they click buttons but not frames? I rememebr in the past it worked for all GUI

GameProcessedEvent (GPE) is a flag that tells you if the player was already using the input for something else, like typing in chat or clicking a UI, If it’s true, it means the game already handled the input, so you probably shouldn’t do anything with it. If it’s false, it means the input is free to use for your own script

1 Like

ah okay. I thought “game processed event” meant that it was “processed by the game” eg it was like 3D vs 2D or something.

the workaround I did was a check of

local function isInsideGui(guiObject)
	local mousePos = getMouse2D()
	local absPos   = guiObject.AbsolutePosition
	local absSize  = guiObject.AbsoluteSize

	return mousePos.X >= absPos.X
		and mousePos.X <= absPos.X + absSize.X
		and mousePos.Y >= absPos.Y
		and mousePos.Y <= absPos.Y + absSize.Y
end

GameProcessedEvent will be true for some GUI components like buttons but typically not things like Frames or TextLabels (since these have no involvement with input) unless they have the active property set to true, which makes them behave similarly to a button.

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