Hello. I am making a script and it does require a lot of debounce so it doesn't run everytime. But I just noticed that im going to have to keep on writing db1 = true db2 = true ... so on. Is there a way to make this more effiecient with a for loop maybe?
local cookies = script.Parent.Parent.CookieGui.Cookies
local frame = script.Parent.Frame
local folder = script.Parent.AchNotifications
local db1 = true
cookies.Changed:connect(function()
if cookies.Value >= 1 and db1 == false then
frame.Ach1.Visible = true
folder.Ach1:TweenPosition(UDim2.new(0.41,0,0.725,0),"Out","Quad",2,true,nil)
wait(6)
folder.Ach1:TweenPosition(UDim2.new(1.5,0,0.725,0),"Out","Quad",2,true,nil)
wait(3)
folder.Ach1:Destroy()
db1 = true
end
end)
Please don't help me with anything else other than the part I asked you to do. The rest of the script is fine.

2 comments
The initial state of the debounce is completely irrelevent, actually.
I know, but both he and you used it wrong. You set it to true, and if debounce was false, then it would run the code. The code would never run.