How I make it so when I press E in chat nothing happens cuz it's annoying (my english bad sory)
wait(1)
local UserInputService = game:GetService("UserInputService")
local KunaiValue = game.Players.LocalPlayer.Backpack.KunaiValue
local ExplosiveKunaiValue = game.Players.LocalPlayer.Backpack.ExplosiveKunaiValue
local WhichKunai = game.Players.LocalPlayer.Backpack.WhichKunai
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Cooldown = false
local ExplosiveCooldown = false
local KeyHeld = false
local HasKunai = false
local CDTime = .4
local EPTime = 2
local KunaiAmount = 0
local Delay = .7
function onKeyPress(inputObject,gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.E then
if WhichKunai.Value == "Kunai" then
if KunaiValue.Value == 0 then return end
if Cooldown then return end
spawn(function()
Cooldown = true
wait(CDTime)
Cooldown = false
end)
KeyHeld = true
script.KeyHeld:FireServer(Player)
while KeyHeld do
if KunaiAmount >= 5 then return end
if KunaiValue.Value == 0 then return end
HasKunai = true
KunaiAmount = KunaiAmount + 1
KunaiValue.Value = KunaiValue.Value - 1
script.SoundEvent:FireServer(Player, KunaiAmount, Mouse)
wait(Delay)
end
end
end
end
function onExplosive(inputObject,gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.E then
if ExplosiveCooldown then return end
spawn(function()
ExplosiveCooldown = true
wait(EPTime)
ExplosiveCooldown = false
end)
if WhichKunai.Value == "ExplosiveKunai" then
if ExplosiveKunaiValue.Value == 0 then return end
print("Shooting explosive kunai..sause!")
ExplosiveKunaiValue.Value = ExplosiveKunaiValue.Value - 1
script.ExplosiveKunai:FireServer(Mouse.Hit)
end
end
end
function onKeyRelease(inputObject,gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.E then
if HasKunai == false then return end
script.KeyRelease:FireServer(KunaiAmount, Mouse.Hit)
KunaiAmount = 0
KeyHeld = false
HasKunai = false
end
end
UserInputService.InputBegan:connect(onKeyPress)
UserInputService.InputEnded:connect(onKeyRelease)
UserInputService.InputBegan:connect(onExplosive)

2 comments
because you have gameProcessedEvent. yet you're not using it in your script
whats that