Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My debounce doesn't work and there is no delay?

The debounce just doesn't work, there is no delay in how fast points are distributed. (yes the script could be shorter but it's my first script)

function givePointss(hit)


 local debounce = false
 local thevehicle = hit.Parent
 local daseat = thevehicle:FindFirstChild("VehicleSeat")
 local p = daseat.Occupant
 local player = p.Parent
 local daplayer = game.Players:GetPlayerFromCharacter(player)
 local coins = daplayer.leaderstats.Coins
if debounce == true then return end 
  debounce = true
  coins.Value = coins.Value +1
  wait(5)
  debounce = false
 end
script.Parent.Touched:connect(givePointss)

3 comments

4

Can you put the code in a code block

0

ahhhh code without a code block

0

done

1 answer

the debounce should be defined out of the function not inside of it

This discussion is preserved as it was. New answers, comments, and votes are closed.