Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What is "game Processed Event"?

Asked by 4 years ago

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)
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" DemonHunterz6 35 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

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
Ad
Log in to vote
1
Answered by 4 years ago

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.

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? Code1400 75 — 4y
0
I don't think it's w a s d keys. youtubemasterWOW 2741 — 4y
0
If you replace inputObject and gameProcessed will it still work? DesertusX 435 — 4y
0
What do you mean by replace? youtubemasterWOW 2741 — 4y

Answer this question