I’m using a script that lets me press “H” and it will remove my player’s helmet. However, this works even when the player is typing in the Roblox chat. Is there a way I can make it so it only removes the helmet if they aren’t typing in the chat?
For example if I press “/” and say “Hi Bill, how are you?” It would remove my helmet and then put it back on, seeing how there are two H’s in that sentence.
This is the code:
"local UIS = game:GetService(“UserInputService”)
UIS.InputBegan:Connect(function()
if UIS:IsKeyDown(Enum.KeyCode.H) then
game:GetService(“ReplicatedStorage”).RemoteEvent:FireServer()
end
end)"
It then fires the remote event and removes the player’s helmets and puts on their hats, or removes their hats and puts on their helmet.