Debounce script not working

I have been trying to make my denounce script work for around 2 hours now. I took out all almost the debounce = true statements and it is still somehow becoming true. This is in a local script in a tool.

I have looked all over the API and devforum and I am still dumbfounded

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local tool = script.Parent
local swingsound = tool:WaitForChild("Swing")
local canattack = tool:WaitForChild("CanAttack")
local debounce = true
tool.Equipped:connect(function()
	local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
	idle:Play()
	local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
	local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
end)

tool.Activated:connect(function()
	if  debounce ~= false then 
		
		wait()
	local choose = math.random(1,2)
		local debounce = false
		if choose == 1 then
			local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
			local debounce = false
			swingsound:Play()
			swing1animation.Looped = false
			local debounce = false
			print(debounce)
			swing1animation:AdjustWeight(10, .1)
		swing1animation:Play()
		wait()
		debounce = false
		wait(2)
		elseif choose == 2 then
			local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
			local debounce = false	
			swingsound:Play()
			swing2animation.Looped = false
			local debouce = false
			print(debounce)
			swing2animation:AdjustWeight(10, 1)
		swing2animation:Play()
		wait()
		debounce = false
		wait(2)
		end
	end
end)

tool.Deactivated:connect(function()
	canattack.Value = true
	print(debounce)
end)

tool.Unequipped:connect(function()
	local hum = char:WaitForChild("Humanoid")
	for _,anim in pairs(hum:GetPlayingAnimationTracks()) do
 		anim:Stop()
	end
end)

… Debounce is set to true by deafult where you’re defining it
“debounce = true”
Change it to false?

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local tool = script.Parent
local swingsound = tool:WaitForChild("Swing")
local canattack = tool:WaitForChild("CanAttack")
----------------------------------------
local debounce = true *************************************
----------------------------------------
tool.Equipped:connect(function()
	local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
	idle:Play()
	local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
	local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
end)

tool.Activated:connect(function()
	if  debounce ~= false then 
		
		wait()
	local choose = math.random(1,2)
---------------------------------------------------
local debounce = false ***********************************************************
---------------------------------------------------
		if choose == 1 then
			local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
-----------------------------------------------------------			
local debounce = false *******************************************
-----------------------------------------------------------
			swingsound:Play()
			swing1animation.Looped = false
-----------------------------------------------------------
local debounce = false *******************************************
-----------------------------------------------------------
			print(debounce)
			swing1animation:AdjustWeight(10, .1)
		swing1animation:Play()
		wait()
		debounce = false
		wait(2)
		elseif choose == 2 then
			local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
----------------------------------------------------------			
local debounce = false ****************************************
-----------------------------------------------------------	
			swingsound:Play()
			swing2animation.Looped = false
--------------------------------------------------------------------
local debouce = false ********************************************
--------------------------------------------------------------------
			print(debounce)
			swing2animation:AdjustWeight(10, 1)
		swing2animation:Play()
		wait()
		debounce = false
		wait(2)
		end
	end
end)

tool.Deactivated:connect(function()
	canattack.Value = true
	print(debounce)
end)

tool.Unequipped:connect(function()
	local hum = char:WaitForChild("Humanoid")
	for _,anim in pairs(hum:GetPlayingAnimationTracks()) do
 		anim:Stop()
	end
end)

I don’t think you are trying to define debounce that many times!

You’re defining the denounce each time you call it. Just have one local debounce = true, then every other one should either be debounce = true or debounce = false.

tool.Activated:connect(function()
	if  debounce == true then 
		debounce = false
		wait()
		local choose = math.random(1,2)
		if choose == 1 then
			local swing1animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch1)
			swingsound:Play()
			swing1animation.Looped = false
			swing1animation:AdjustWeight(10, .1)
			swing1animation:Play()
			wait()
		elseif choose == 2 then
			local swing2animation = script.Parent.Parent.Humanoid:LoadAnimation(script.Punch2)
			swingsound:Play()
			swing2animation.Looped = false
			swing2animation:AdjustWeight(10, 1)
			swing2animation:Play()
			wait()
		end
		debounce=true
	end
end)