Remove global debounce?

Im trying to make a system where when you touch a part it created a burst effect but it can be only touched once
the burst plays but i cant make the debounce just for the player

local db = false
script.Parent.Touched:connect(function(hit)
	if not db then
		db = true
	if hit and hit.Parent and hit.Parent:FindFirstChild("HumanoidRootPart") then
			hit.Parent.HumanoidRootPart.ParticleAttachment.Burst.Enabled = true
			wait(0.5)
			hit.Parent.HumanoidRootPart.ParticleAttachment.Burst.Enabled = false
		end
		wait(999999)
		db = false
		end
end)

thanks.

First, please capitalize Connect and use task.wait() instead of wait().

Second, why even bother setting db back to false with a wait of nearly a million seconds?

Third, add the player’s name and db status to a table and check the player’s status rather than a global one.

1 Like

so, the script works absolutely fine, all i need to know is to find a way to make the debounce work for a character
wait() and connect pretty much still works right now
i am also a new scripter so thats why im here making posts

For example:

local plrTable = {}
script.Parent.Touched:Connect(function(hit)
	if not plrTable[hit.Parent.Name] then
		plrTable[hit.Parent.Name] = true
	--more code

im basically gonna be using the playertable as a debounce but it works for a player only?

Yes, it will be player-specific as you asked.