|
| 10 Jun 2014 02:51 PM |
confirm.Buy.MouseButton1Down:connect(function() print("c") local debounce = false if player.leaderstats.Robux ~= nil then if debounce == false then debounce = true print("a") if player.leaderstats.Robux.Value >= price then print(price) player.leaderstats.Robux.Value = player.leaderstats.Robux.Value - price print("b") end debounce = false end end end)
--(Everything is defined) |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:52 PM |
| perhaps you should add a wait in the middle and see if it changes anything? |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:54 PM |
forgot to put in the wait while pasting this script (its part of a script)
confirm.Buy.MouseButton1Down:connect(function() print("c") local debounce = false if player.leaderstats.Robux ~= nil then if debounce == false then debounce = true print("a") if player.leaderstats.Robux.Value >= price then print(price) player.leaderstats.Robux.Value = player.leaderstats.Robux.Value - price print("b") end wait(1) debounce = false end end end) |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 10 Jun 2014 02:54 PM |
Becuase you made the debounce a local variable within the scope of the event. You gotta do this:
local debounce = false
confirm.Buy.MouseButton1Down:connect(function() print("c") if player.leaderstats.Robux ~= nil then if debounce == false then debounce = true print("a") if player.leaderstats.Robux.Value >= price then print(price) player.leaderstats.Robux.Value = player.leaderstats.Robux.Value - price print("b") end debounce = false end end end) |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:56 PM |
| still repeats multiple times even with the wait |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 10 Jun 2014 02:58 PM |
| Well it should work, were are you putting the wait function? |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 02:59 PM |
local debounce = false
confirm.Buy.MouseButton1Down:connect(function() print("c") if player.leaderstats.Robux ~= nil then if debounce == false then debounce = true print("a") if player.leaderstats.Robux.Value >= price then print(price) player.leaderstats.Robux.Value = player.leaderstats.Robux.Value - price print("b") end wait(1) debounce = false end end end)
this is part of a global function if that makes a difference |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 10 Jun 2014 02:59 PM |
| Nvm I see where you put it in your last post. |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
|
| 10 Jun 2014 03:06 PM |
| I'm not really sure why, if it just prints "c" a lot of times then that's fine because you didn't put it within the "if debounce == false" statement. |
|
|
| Report Abuse |
|
|
|
| 10 Jun 2014 03:09 PM |
| want the whole global function and the script that activates the function? |
|
|
| Report Abuse |
|
|
spynaz
|
  |
| Joined: 17 Feb 2011 |
| Total Posts: 1326 |
|
| |
|