Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
Edited 6 years ago
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)
4
Can you put the code in a code block User#5423 17 — 6y
0
ahhhh code without a code block hiimgoodpack 2009 — 6y
0
done headysocky 0 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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

Ad

Answer this question