My code is
local toggle = script.Parent.Frame.Toogle game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.E then --So on
How can I disable it when the player is chatting, it messes up the game if it activates.
Any thoughts?
The second argument of UserInputService.InputBegan
, is_game_processed
, is true
if the input has been processed/handled by the game (GUI, etc.) prior to making the event fire:
game:GetService("UserInputService").InputBegan:Connect(function(input, is_game_processed) -- If the input has already been processed by the game, return from the function. if is_game_processed then return end -- ... end)