Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this script not get activated when I'm writing to chat / commands?

I have this script that does something but I accidentally turn it on when writing something to the chat.

local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local tool = script.Parent

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		RS.FireStart:FireServer()
	end
end)

2 answers

✓ Accepted answer
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local tool = script.Parent

UIS.InputBegan:Connect(function(input, IsTyping)
    if IsTyping then return end

    if input.KeyCode == Enum.KeyCode.E then
        RS.FireStart:FireServer()
    end
end)
local UIS = game:GetService("UserInputService")
local RS = game:GetService("ReplicatedStorage")
local tool = script.Parent

UIS.InputBegan:Connect(function(input,Typing)
    if input.KeyCode == Enum.KeyCode.E and not Typing then
        RS.FireStart:FireServer()
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.