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)
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.