#i may be smart but how the f do i make a debounce on the click like make a cooldown on the button

15 messages · Page 1 of 1 (latest)

clever pumice
#

like i need it to wait a certain amount before the player can click the on/off button again

strong jasper
#

example of making a cooldown

local debounce = false
local part = script.Parent
part.Touched:Connect(function(hit)
  if hit.Parent:FindFirstChild("Humanoid") and debounce == false then
 --                                                     |
 --                                         checks if debounce is false
    debounce = true
    -- do something
    wait(5)
    debounce = false
  end
end)
clever pumice
#

oh

#

ok

#

tyy

strong jasper
#

yw

clever pumice
#

omg ty it works :)

boreal pelican
#

debounce

#

ez

clever pumice
clever pumice
dense hingeBOT
#

studio** You are now Level 10! **studio