Hey Guys!
I am currently helping develop a game, and I ran into a problem with UserInputService and in-game Roblox Chatting. Whenever I press a keybind or hotkey or whatever you would like to call it while chatting in Roblox Chat, the function of that key in general fires, which is not favorable. I don’t think it is necessary to show screenshots or videos, because this is mostly straightforward. Here is the script:
local UserInputService = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local Respawn = game:GetService("ReplicatedStorage"):FindFirstChild("Respawn")
local rKey = Enum.KeyCode.R
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == rKey then
Respawn:FireServer()
end
end)
UserInputService.InputBegan:Connect(function(Input, GameProcessedEvent)
if GameProcessedEvent then return end
if Input.KeyCode == Enum.KeyCode.E then
...
end
end)
GameProcessedEvent 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 else, it would be false.