local db = true
local character = game.Players.LocalPlayer.Character
local humanoid = character:FindFirstChild(“Humanoid”)
local anim = humanoid:LoadAnimation(script:WaitForChild(“Animation”))
local Tool = script.Parent – This Local Script is Inside the Tool
local EquippedTool = false – A Bool Type of Variable
Tool.Equipped:Connect(function() – When Player Equips
EquippedTool = true – Bool Sets to True
end)
Tool.Unequipped:Connect(function() – When Player Unequipped
EquippedTool = false – Bool Sets to False
end)
– // Now We Want to Check When the Player Presses “E”
local UserInputService = game:GetService(“UserInputService”) – We Define UserInputService
UserInputService.InputBegan:Connect(function(Input,Engine) – When An Input Begins
if not Engine then – This Line Checks if the Player is Not Typing in chat / etc
if Input.KeyCode == Enum.KeyCode.E then – Is Player Pressed ‘E’
if EquippedTool == true then – This Checks if the Tool Is Equipped
print(“Player Pressed E While Tool Equipped”)
local dmg
game:GetService(“UserInputService”).InputBegan:Connect(function(pressed)
if pressed.KeyCode == Enum.KeyCode.C and db then
db = false
anim:Play()
dmg = true
wait(1.3)
dmg = false
db = true
end
end)
– What you want to do
end
end
end
end)