Debounce problems2.0

script:

for _,v in pairs(game.Workspace.Part:GetChildren()) do
local debounce = false	
local cd = 2
	v.Touched:Connect(function(hit)
		debounce = true
		
		if hit.Parent:FindFirstChild("Humanoid") then
			
			hit.Parent.Humanoid:TakeDamage(10)
			wait(cd)
                        debounce = false
		end
	end)
	end
1 Like

Whats the problem though…? Pretty hard to check what the error is without knowing the problem.

1 Like

You aren’t using the debounce anywhere. You’re setting it to true and false, but doing nothing with it. You need to actually check the debounce in the if statement for it to actually work.

1 Like

So like

if debounce == false then
1 Like

Yeah. This would also work in OP’s case:

if hit.Parent:FindFirstChild("Humanoid") and not debounce then
2 Likes