I Need help, i don´t know how to debouce this script, i saw that when i click too many times, the the barricade goes bad, it doesn´t do the wait(5) but when you click one time and you wait the 5 seconds it is normal, i want to do this because People can spam it and the wait(5) doesn´t respond well...
local isOn = true local debouce = false function on() isOn = true script.Parent.Transparency = 0 script.Parent.CanCollide = true end function off() isOn = false script.Parent.Transparency = 0.8 script.Parent.CanCollide = false wait(5) script.Parent.Transparency = 0 script.Parent.CanCollide = true end function onClicked() if isOn == true then off() else off() end end script.Parent.ClickDetector.MouseClick:connect(onClicked) on()