Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What is "game Processed Event"?

Hi. i've been using stuidio for a good while now and have been using the user input service just fine but when i see other people code or watch tutorials on youtube people add in an extra parameter to the input function, "gameProcessed". could some one please explain to me what it does and how to use it correctly as it does not seem to work for me.

Uis.InputBegan:Connect(function(inputObject, gameProcessed)
	if inputObject.KeyCode == Enum.KeyCode.E and gameProcessed then
		print("Blahblahblah")
	end
end)

1 comment

0

This was taken from the Roblox API Reference: "Indicates whether the game engine internally observed this input and acted on it. Generally this refers to UI processing, so if a button was touched or clicked from this input, gameProcessedEvent would be true. This is also true for input events connected via ContextActionService"

2 answers

✓ Accepted answer

This was taken from the Roblox API Reference:

"Indicates whether the game engine internally observed this input and acted on it. Generally, this refers to UI processing, so if a button was touched or clicked from this input, gameProcessedEvent would be true. This is also true for input events connected via ContextActionService"

The reason that is not working is that "gameProcessedEvent" is usually used for UI only (mouse clicks) which doesn't involve pressing buttons that much. I suggest you try this instead:

Uis.InputBegan:Connect(function(inputObject, gameProcessed)
	if gameProcessedEvent then return end

		if inputObject.UserInputType == Enum.UserInputType.Keyboard then
			local KeyCode = inputObject.KeyCode
			
			if KeyCode == Enum.KeyCode.E then
			print("whatever")
		end

The gameProcessed event tells whether the player is interfering in the game engine. For example, the chat. gameProcessed kind of means "inChat". You can use it like this:

Uis.InputBegan:Connect(function(inputObject, gameProcessed)
	if inputObject.KeyCode == Enum.KeyCode.E and not gameProcessed then
		print("Blahblahblah")
	end
end)

Just use the not keyword in front of it.

4 comments

0

so does game processed equal to true if the defualt functions of the game input have already observed the input. such as typing in chat, or using w a s d keys?

0

I don't think it's w a s d keys.

0

If you replace inputObject and gameProcessed will it still work?

0

What do you mean by replace?

This discussion is preserved as it was. New answers, comments, and votes are closed.