so how can i make it so tool animations and attacks only work when you are holding the tool UserInputService.InputBegan:Connect(function(Input, IsTyping) if IsTyping then return end ^^^ only work when you are typing but when im just pressing attacks still play

-- E attack
local plr = game.Players.LocalPlayer

local Player = game.Players.LocalPlayer
local Character = Player.Character or script.Parent
local Humanoid = Character.Humanoid
local UserInputService = game:GetService("UserInputService")

local AnimationID = 'rbxassetid://4913950465'

local key = 'E'
local debounce = true

UserInputService.InputBegan:Connect(function(Input, IsTyping)
	if  IsTyping then return end
	if Input.KeyCode == Enum.KeyCode[key] and debounce == true then
		debounce = false
		local Animation = Instance.new("Animation")
		Animation.AnimationId = AnimationID
		local LoadAnimation = Humanoid:LoadAnimation(Animation)
		LoadAnimation:play()
	
	
		local Tool = script.Parent
	local Blade = Tool:WaitForChild("Blade")
	local Trail = Blade:WaitForChild("Trail")
	Trail.Enabled = true
	
		

			local player = game:GetService("Players").LocalPlayer
	local Character = player.Character or player.CharacterAdded:Wait()
	local RootPart = Character.HumanoidRootPart
	plr.Character.Humanoid.WalkSpeed = 0
	local BV = Instance.new("BodyVelocity")
	BV.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	BV.Velocity = RootPart.CFrame.lookVector.Unit * 10
	
	BV.Parent = RootPart
	wait(1.3)
	

	Trail.Enabled = false


	BV:Destroy()
	

		debounce = true
			plr.Character.Humanoid.WalkSpeed = 16
wait(2)

		end
	end)