Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how do i make this script not willing to do the action if presses the "e" key when typing in chat?

Asked by 5 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

local tabDown = false local input = game:GetService("UserInputService") local player = game.Players.LocalPlayer

input.InputBegan:connect(function(k) local key = k.KeyCode if key == Enum.KeyCode.E then tabDown = true end end)

input.InputEnded:connect(function(k) local key = k.KeyCode if key == Enum.KeyCode.E then tabDown = false end end)

while wait(0.05) do if tabDown then local Event = game:GetService("ReplicatedStorage").Specials.throatslit local A_1 = 2000 Event:FireServer(A_1) end end

1
InputBegan has a second parameter called GameProcessedEvent, if you add that parameter in and add an if statement saying if not GPE then it will not run if ur typing in chat for example User#7446 0 — 5y
0
well its just like too mixed and confusing for me if u can i wish pls do it for me nobb93815_newaccount 0 — 5y
0
like i want it to be holdable too when doesnt fire when player is typing nobb93815_newaccount 0 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Hello, From what i have seen in your LOCALSCRIPT...

I found a few things that could make some nasty problems, so i have written a fresh and new familiar LOCALSCRIPT for you, hopefully, this shall work.


UIS = game:GetService("UserInputService") CHECK = false RUN = false

UIS.InputBegan:Connect(function(INPUT, PROC) if INPUT.KeyCode = Enum.KeyCode.E and not PROC and CHECK == false then

RUN = true CHECK = true wait() end end

UIS.InputBegan:Connect(function(INPUT, PROC) if INPUT.KeyCode = Enum.KeyCode.E and not PROC and CHECK == true then RUN = false CHECK = false wait() end end

while wait(0.05) do
if RUN == true then
local RE = game:GetService(“ReplicatedStorage”).Specials.throatslit
local A_1 = 2000
RE:FireServer(A_1)

end
end


0
Please use local when defining variables, also please enclose code in codeblocks. RubenKan 3615 — 5y
0
doesnt work :/ nobb93815_newaccount 0 — 5y
0
I'm sorry, but the new TYPE system is quite hard to use, when i try to place the code in codeblocks, it only works for one line. User#26986 0 — 5y
Ad

Answer this question