lua
local Tool = script.Parent
local Idle_Track
local Character
local Debounces = {
Touch = false;
Hit = false;
Activate = false;
}
Tool.Equipped:Connect(function()
Character = Tool.Parent
Idle_Track = Character:WaitForChild('Humanoid'):LoadAnimation(script:WaitForChild('Idle'))
Idle_Track:Play()
end)
Tool.Unequipped:Connect(function()
if Idle_Track then
Idle_Track:Stop()
Idle_Track = nil
end
end)
Tool.Activated:Connect(function()
if Debounces.Activate then return end
Debounces.Activate = true
local Attack_Track = Character:WaitForChild('Humanoid'):LoadAnimation(script:WaitForChild('Attack'))
Attack_Track:Play()
Debounces.Hit = true
Attack_Track.Stopped:Wait()
Debounces.Hit = false
Debounces.Activate = false
end)
Tool:WaitForChild('Handle').Touched:Connect(function(partWeHit : BasePart)
if Debounces.Touch or not Debounces.Hit then return end
Debounces.Touch = true
local Humanoid = partWeHit.Parent:FindFirstChildOfClass('Humanoid')
if Humanoid and Humanoid.Parent ~= Character then
Debounces.Hit = false
Humanoid:TakeDamage(35)
end
Debounces.Touch = false
end)