Below is my code, I don't want this to trigger when the player is chatting but I do want it to when they hit the key though.
function onKeyPressed(inputObject, gameProcessEvent)
if inputObject.KeyCode == Enum.KeyCode.E then
print("E")
Below is my code, I don't want this to trigger when the player is chatting but I do want it to when they hit the key though.
function onKeyPressed(inputObject, gameProcessEvent)
if inputObject.KeyCode == Enum.KeyCode.E then
print("E")
Hey there, there is a preatty easy solution for that! You can use the context action service in roblox, so it wont trigger when you write in chat.
Here is the link to ContextActionService: https://developer.roblox.com/en-us/api-reference/class/ContextActionService.
I hope I could help you out. If you need any help implementing it into your systeme, make sure to contact me, so I can help you out. Have a nice day, esepek.
You have to be kidding me. You do realize that there is a parameter supplied to the 'InputBegan' Callback that can debounce this... You have no need to shift to entirely new Service.
Well I think CAS is the best solution in this case. Not only can you solve the current problem but its much easyer to define when certain inputs should have an effect or not. And YES you could check if another script has already processed the input , but why wouldnt you just go with CAS in the first place? I mean what if he wants to add Mobile buttons?? I think CAS is the better solution here!
Hello @NortonHDD, I realized that although gameProessedEvent is a parameter of your function, you don't actually check if the event is game processed or not.
Try this:
local function onKeyPressed(inputObject, gameProcessEvent)
if not (gameProcessEvent) then
if inputObject.KeyCode == Enum.KeyCode.E then
print("E")
end
end
end
Hope this helps :D
If the InputBegan Event was processed by the game's core-scripts, to be exact in its definition.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Use the 'GameProcessedEven't boolean...................