This script is basically a cash rewarding script for the end of an obby.. I've added a debounce but it doesn't seem to work. I can just keep on touching the brick for 5 seconds and it rewards me every time..
The rest of the code works.
chances = {1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,10}
debounce = false
script.Parent.Touched:connect(function(hit)
debounce = true
number = chances[math.random(1,#chances)]
player = game.Players:FindFirstChild(hit.Parent.Name)
if player and debounce then
player.leaderstats.FCash.Value = player.leaderstats.FCash.Value + number
str = "Well Done "..hit.Parent.Name..". You have earned "..number.." FCash! Did you know? There was a "..11-number.." in 55 chance of getting "..number.."!"
script.Parent.SurfaceGui.TextBox.Text = str
wait(5)
player:LoadCharacter()
end
wait(5)
script.Parent.SurfaceGui.TextBox.Text = "i hop u licked dis11 ;) - g"
debounce = false
end

2 comments
Thanks for the help bro! Want something I can do in return?
no thanks dude but thanks for the offer