w8lq
|
  |
| Joined: 06 Jun 2017 |
| Total Posts: 355 |
|
|
| 28 Jul 2017 08:52 AM |
amount = 5 timedelay = 1 currencyname = "Cash"
script.Parent.mouseClick:connect(function() script.Parent.Parent.Parent.Target.Transparency = 0.5 while true do wait() for i,v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("leaderstats") and v then v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount wait(2) script.Parent.Parent.Parent.Target.Transparency = 0 end end end end)
This is a button that gives the player money however i would like to add something like a 1 second pause inbetween to prevent spamming. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2017 08:54 AM |
amount = 5 timedelay = 1 currencyname = "Cash" debounce = true script.Parent.mouseClick:connect(function() if debounce == true then debounce = false script.Parent.Parent.Parent.Target.Transparency = 0.5 while true do wait() for i,v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("leaderstats") and v then v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount wait(2) script.Parent.Parent.Parent.Target.Transparency = 0 wait(timedelay) debounce = true end end end end)
▪ I seem to get mentioned alot in videogames.. i wonder why.. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2017 08:57 AM |
debouncing.
bool = true
function dostuff()
if bool == true then
bool = false
--stuff.
bool = true
end
end
there you go. |
|
|
| Report Abuse |
|
|
w8lq
|
  |
| Joined: 06 Jun 2017 |
| Total Posts: 355 |
|
|
| 28 Jul 2017 08:58 AM |
| Workspace.Model.Target.ClickDetector.Script:21: unexpected symbol near ')' |
|
|
| Report Abuse |
|
|
w8lq
|
  |
| Joined: 06 Jun 2017 |
| Total Posts: 355 |
|
|
| 28 Jul 2017 09:02 AM |
Do I put; bool = true
end
end
after the other ends or before (the ones in the original script) |
|
|
| Report Abuse |
|
|
w8lq
|
  |
| Joined: 06 Jun 2017 |
| Total Posts: 355 |
|
| |
|
|
| 28 Jul 2017 09:07 AM |
amount = 5 timedelay = 1 currencyname = "Cash" debounce = true script.Parent.MouseClick:connect(function() if debounce == true then debounce = false script.Parent.Parent.Parent.Target.Transparency = 0.5 wait() for i,v in pairs(game.Players:GetPlayers()) do if v:FindFirstChild("leaderstats") and v then v.leaderstats[currencyname].Value = v.leaderstats[currencyname].Value + amount end end wait(timedelay) script.Parent.Parent.Parent.Target.Transparency = 0 debounce = true end end)
^^ this should work
▪ I seem to get mentioned alot in videogames.. i wonder why.. |
|
|
| Report Abuse |
|
|
w8lq
|
  |
| Joined: 06 Jun 2017 |
| Total Posts: 355 |
|
| |
|