|
| 07 Sep 2013 08:42 PM |
game:service'Players'.PlayerAdded:connect(function(p) coroutine.wrap(function() Gold=p:WaitForChild'PlayerGui':WaitForChild'GameGUI':WaitForChild'Gold'; if game:service'BadgeService':UserHasBadge(129091770,p) and not p:LoadBoolean('GoldGiven') then Gold.Value=Gold.Value+20; p:SaveBoolean('GoldGiven',true); end; end)(); end;
so I have a game pass for +20 gold. Gold is in StarterGui.GameGUI.Gold I want it to only give +20 once. what's wrong? There's also a gold cap, like I have 84/100 to test the cap, and my friend had 22/50 and it didn't give 20 to either of us... :/ |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 07 Sep 2013 08:45 PM |
game:service('Players').PlayerAdded:connect(function(p) coroutine.wrap(function() Gold=p:WaitForChild('PlayerGui'):WaitForChild('GameGUI'):WaitForChild('Gold') if game:service('BadgeService'):UserHasBadge(129091770,p.userId) and not p:LoadBoolean('GoldGiven') then Gold.Value=Gold.Value+20 p:SaveBoolean('GoldGiven',true) end end) end) |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 08:47 PM |
| Im sorry but thats the nastiest script Ive ever seen e.e |
|
|
| Report Abuse |
|
|
| |
|
Joshuats
|
  |
| Joined: 14 May 2008 |
| Total Posts: 847 |
|
|
| 07 Sep 2013 08:54 PM |
game:GetService'Players'.PlayerAdded:connect(function(p) coroutine.wrap(function() local Gold=p:WaitForChild'PlayerGui':WaitForChild'GameGUI':WaitForChild'Gold'; if game:GetService'BadgeService':UserHasBadge(129091770,p) and not p:LoadBoolean('GoldGiven') then Gold.Value=Gold.Value+20; p:SaveBoolean('GoldGiven',true); end; end)(); end; |
|
|
| Report Abuse |
|
|
Joshuats
|
  |
| Joined: 14 May 2008 |
| Total Posts: 847 |
|
|
| 07 Sep 2013 08:56 PM |
Additionally... you may want to add:
'p:WaitForDataReady()' before the 'if' statement (right term? :P). |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 07 Sep 2013 09:01 PM |
| use mine and on the 2nd line add p:WaitForDataReady() |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 07 Sep 2013 09:02 PM |
| What's the point of using coroutine.wrap |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 09:08 PM |
| Still none work... could it be because I have 86/100 gold? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 07 Sep 2013 09:59 PM |
| Why do you need coroutine.wrap, exactly? |
|
|
| Report Abuse |
|
|
|
| 07 Sep 2013 10:11 PM |
Well a friend was helping me make the script and she did it that way :? any way would be fine if it worked... |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 07 Sep 2013 10:13 PM |
game:service("Players").PlayerAdded:connect(function(p) Gold=p:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("Gold") if game:service("BadgeService"):UserHasBadge(129091770,p.userId) and not p:LoadBoolean("GoldGiven1") then Gold.Value=Gold.Value+20 p:SaveBoolean('GoldGiven1',true) end end)
|
|
|
| Report Abuse |
|
|
| |
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 07 Sep 2013 10:23 PM |
game:service("Players").PlayerAdded:connect(function(p) p:WaitForDataReady() Gold=p:WaitForChild("PlayerGui"):WaitForChild("GameGUI"):WaitForChild("Gold") if game:service("BadgeService"):UserHasBadge(129091770,p.userId) and not p:LoadBoolean("GoldGiven1") then Gold.Value=Gold.Value+20 p:SaveBoolean('GoldGiven1',true) end end) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 07 Sep 2013 10:46 PM |
http://www.roblox.com/Remote-Error-Monitoring-System-item?id=65774258 Use that and see if there are any errors. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 02:10 AM |
| finally figured it out, thanks. |
|
|
| Report Abuse |
|
|