So in my game, there are powerups that activate with Q and E.
game:GetService("UserInputService").InputBegan:Connect(function(inputObject, gameProcessedEvent)
if inputObject.KeyCode == Enum.KeyCode.Q then
tool["Metal Powerup"]:Play()
speed:FireServer()
elseif inputObject.KeyCode == Enum.KeyCode.E then
tool["Metal Powerup"]:Play()
defense:FireServer()
end
end)
The code is fine and everything, but a huge problem occurs when a player is typing, and when they press Q or E while typing, the powerups will activate. How do I make it so that it will not trigger when a player is chatting? It can be frustrating to players, so I would really appreciate the help. This script is inside a tool.