|
| 18 Jan 2015 06:46 AM |
For some reason, this script is not working... CashStore = game:GetService('DataStoreService'):GetDataStore('DataStore') function PlayerEntered(player) repeat wait() until player.Character local stats = Instance.new('IntValue') stats.Parent = player stats.Name = 'leaderstats' local cash = Instance.new('IntValue') cash.Parent = stats cash.Name = 'Cash' if CashStore:GetAsync('Points_'..player.Name) ~= nil then cash.Value = CashStore:GetAsync(player.name) else cash.Value = 50 end cash.Changed:connect(function(Val) CashStore:SetAsync('Points'..player.Name, Val) end) end
|
|
|
| Report Abuse |
|
|
fun4nerd4
|
  |
| Joined: 13 Nov 2014 |
| Total Posts: 155 |
|
|
| 18 Jan 2015 06:52 AM |
You only have a certain amount of request per minute! So when u did this
repeat wait() until
I WAS LIKE!
(X)_(X) there is your problem!
Here do this!
repeat wait(1) until --- CODE CODE CODE end |
|
|
| Report Abuse |
|
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Jan 2015 06:55 AM |
| I didn't see any game.Players.PlayerAdded connect line |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2015 06:57 AM |
The whole function isn't the request. He waited outside of the request to get and send his data, so it shouldn't matter, right?
M'kay. |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2015 06:57 AM |
Also, eLunate is right. :)
M'kay. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 18 Jan 2015 06:57 AM |
| i see no reason for the repeat wait() until player.Character, is there a single reference to the character in the script? no |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2015 07:03 AM |
| Alright, thanks for all of your answers, guys! |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2015 07:06 AM |
Oh no.
It isn't saving the Cash value... |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 18 Jan 2015 07:10 AM |
| and did you test it on studio? |
|
|
| Report Abuse |
|
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|
|
| 18 Jan 2015 07:14 AM |
| So how can I fix this?????????? |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 18 Jan 2015 07:18 AM |
this should work:
CashStore = game:GetService('DataStoreService'):GetDataStore('DataStore') game.Players.PlayerAdded:connect(function(new) local stats = Instance.new('IntValue',new) stats.Name = 'leaderstats' local cash = Instance.new('IntValue',stats) cash.Name = 'Cash' if CashStore:GetAsync('Points_'..new.userId) ~= nil then cash.Value = CashStore:GetAsync('Points_'..new.userId) else cash.Value = 50 end end)
game.Players.PlayerRemoving:connect(function(old) CashStore:SetAsync('Points_'..old.Name, old.leaderstats.Cash.Value) end) |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 18 Jan 2015 07:21 AM |
lol i didnt change the last part:
game.Players.PlayerRemoving:connect(function(old) CashStore:SetAsync('Points_'..old.userId, old.leaderstats.Cash.Value) end) |
|
|
| Report Abuse |
|
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 18 Jan 2015 07:26 AM |
Just do like,
game.Players.PlayerRemoving:connect(function(p) CashStore:SetAsync('Points_'..player.Name, p.leaderstats.Cash.Value); end) game.OnClose = function() wait(10) end
And append that to the end lol |
|
|
| Report Abuse |
|
|