As the Title says, my Debounce in a script is not working. I am probably doing something extremely stupid which I am overlooking. Anyways, here is the script.
local DefenceBush = game.Workspace.DefenceBush
DefenceBush.TouchMe.Touched:connect(function(Hit)
if Hit.Name ~= "Handle" and Hit.Parent:FindFirstChild("Humanoid") and Hit.Parent.Humanoid.Health ~= 0 then
local DB = false
if DB == false then DB = true
wait(60)
DB = false
end
end
end)
All that occurs is the second a player makes contact with the Berry Bush, we check to see if It's a player that is alive and then I make my Debounce (DB) as false and check if it's false, if so, make it true then continue the script which decided randomly whether the player get 1-3 berries then a 60 second cooldown occurs and DB becomes true thus making the Berries visible. The player should not be able to receive berries when they touch the Bush during the cooldown, however they do.

1 comment
Thank you for the assistance.