Debounce not working

Hey all! I have been stuck on fixing this debounce for awhile, when the player steps on it it fires twice (in console, print(vb) fires twice)

Here is the code: 
	```
local Touching
local Debounce = false

CurrentPath.Touched:Connect(function(Hit)
	CurrentPath.CanTouch = false
	if Debounce == true then
		return
	end

	Debounce = true

	if Touching == true then
		Debounce = false
		CurrentPath.CanTouch = true

		return
	end

	print("vb")
end)
```

As you can see, I’ve tried with a variable & with .CanTouch disabling and enabling, there is some other code but I have redacted it as I don’t think it is useful to help me solve this bug

If anyone wants to offer some support or wants to ask some questions, do please reply!

I fixed the issue, the for loop where it does Part.Touched would activate everytime a purchase was made, so it would create multiple threads

If you solved it yourself 9 minutes after your post, why even make a post in the first place?

  1. If other people have a similar issue, they might see how I solved it
  2. It’s not a big deal, my post says it got solved
  3. I thought I have tried everything else.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.