Alrighty now, I understand that it checks if the player is typing but how? I asked somewhere else and they said its " GameProccesedEvent" right and then they told me after i asked that it can be anything they gave examples like PlayerTyping, PlayerIsTyping etc. So i was just wondering what’s going on? like can i name it anything? like banana and it’ll check or doesd it have to incliude typing I honestly dont understand and im so stumped as to how this works lol, Does GameProccesedEvent check for typing? or does it check for typing because we’re writing something to do with typing, does it just read typing and Assume thats what I’m asking I’m really lost. Any answers appreciated.
if i sound crazy and you dont understand just let me know and I’ll try to rewrite this better lol
In a UIS event, that value is true whenever the player is interacting with a roblox gui, so you can use that to prevent interference between your defined inputs and roblox inputs. For example, if you made it so that pressing the ‘F’ key fires a laser you would want to make sure that you don’t fire it whenever you type an F in the chat window.
Yes, you can name the parameters anything because it’s still the same arguments that get passed to the function.
-- example:
local function printThis(this)
print(this)
end
printThis("hello")
-- and
local function printThis(thiss)
print(thiss)
end
printThis("hello")
-- would both do the same thing.
gameProcessedEvent is “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” (from the api reference).
- basically you can use it to ignore input if it was from a user typing in chat, or if they clicked on something in the CoreGui, etc.
The variable can be named anything because it is a variable. Think of the InputBegan listener as one of your own functions. When calling a function, you will pass the required arguments, and when the function receives the arguments it’s renamed to whatever you want it to be.
local function myFunction(banana) -- same variable, but renamed
print(banana)
end
local myVar = "This is a a string"
myFunction() -- prints the `myVar` variable, but under the temporary variable `banana` as named in myFunction
To define gameProcessedEvent I’ll delve into a simple explanation: if a game recognizes the input is binded to something, then gameProcessedEvent will read true. This can be typing, or a ContextActionService Binded Action, forgive me if I am missing any others.
I suggest looking into learning about functions in Lua, what parameters and arguments are as well etc. - you can set a parameter to have any valid name you want, the event UserInputService.InputBegan passes an input object and a bool value indicating whether the engine acted on this input, if it’s true then it means it has been processed, such as through the player typing in the chat window.
The callback you pass to the listener will execute and work with, if you specify expected arguments to be taken by the function, what the information the event passed.