How Do I Make Debounce For + 5 Speed In This Script

local PunchBack = game.Workspace:FindFirstChild(“PunchBag”)
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
PunchBack.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild(“Humanoid”) then
player.leaderstats.Speed.Value = player.leaderstats.Speed.Value + 5
print(player.Name…“Touched!”)

      end
	
end)

end)

Hello, I have replied your old topic; check it please.

it didnt work it was all errors

Can you send me the error? So I can solve it.

You can’t/shouldn’t edit values with a local script.
(I’ll fix it.)

Try that
local PunchBack = game.Workspace:FindFirstChild("PunchBag")
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
	if not debounce then
	PunchBack.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid") then
				local player = game.Players[hit.Parent.Name]
			player.leaderstats.Speed.Value += 5
				print(player.Name.." Touched")
				debounce = true
				wait(3)
				debounce = false
				
	end
			end)
		end
end)

This time, it will probably work.
Reply me about the script, please

just, Try the’s,
Script,

local deb = false
local PunchBack = game.Workspace:FindFirstChild("PunchBag")
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if not deb then
		task.wait(0.5)
		deb = false
	end
	PunchBack.Touched:Connect(function(hit)
		if hit.Parent:FindFirstChild("Humanoid") then
			wait(0.5)
			deb = true
			player.leaderstats.Speed.Value = player.leaderstats.Speed.Value + 5
				print(player.Name.."Touched!")	
	
          end
		
	end)
end)