for example, Disable press W to print something while chatting.
like
(local script)
local Chatting = false
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent) -- Key
if inputObject.KeyCode == Enum.KeyCode.W and Chatting == false then
print("W")
end
end)
you can use the second parameter itself
if it returns true then it means the player is typing
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent) -- Key
if inputObject.KeyCode == Enum.KeyCode.W and gameProcessedEvent == false then
print("W")
end
end)
local UserInput = game:GetService("UserInputService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local ChatBar = PlayerGui:FindFirstDescendant("ChatBar")
local Chatting = false
ChatBar.Focused:Connect(function()
Chatting = true
end)
ChatBar.FocusLost:Connect(function()
Chatting = false
end)
UserInput.InputBegan:connect(function(Input, Processed)
if Chatting then
return
end
if Input.KeyCode == Enum.KeyCode.Backspace then
print("Backspace key pressed!")
end
end)