|
| 09 Mar 2014 10:04 AM |
Okay, so this is my new leaderboard using data store. pointStorage = game:GetService("DataStoreService"):GetDataStore("points")
game.Players.PlayerAdded:connect(function(player) leaderstats = Instance.new("Model", player) leaderstats.Name = "leaderstats" points = Instance.new("IntValue", leaderstats) points.Name = "Points" points.Value = 0
-- Check if their data is still kept by Data Persistance player:WaitForDataReady() if player:LoadNumber("Points") ~= 0 then pointStorage:SetAsync(player.userId, player:LoadNumber("Points")) player:SaveNumber("Points", 0) end
key = pointStorage:GetAsync(player.userId) if key ~= nil then points.Value = key end --[[points.Changed:connect(function(value) key:SetAsync(player.userId, value) end)--]] points.Changed:connect(function(value) if value >= 5000 then game:GetService("BadgeService"):AwardBadge(player.userId, _G.points5000) end if value >= 10000 then game:GetService("BadgeService"):AwardBadge(player.userId, _G.points10000) end if value >= 20000 then game:GetService("BadgeService"):AwardBadge(player.userId, _G.points20000) end --[[ pointStorage:SetAsync(player.userId, points.Value) game.Workspace.DEBUGBLOCK.BrickColor = BrickColor.new("Lime green") wait(2) game.Workspace.DEBUGBLOCK.BrickColor = BrickColor.new("Really red") --]] end) end)
game.Players.PlayerRemoving:connect(function(player) leaderstats = player:FindFirstChild("leaderstats") value = leaderstats.Points.Value pointStorage:UpdateAsync(player.userId, function(oldValue) return player.leaderstats.Points.Value end) end)
The problem is, your score is NEVER saved. I have even tried using the DEBUGBLOCK and it does change the color, so the SetAsync is working, but it's just not saving. :/ Any help, would be extremely appreciated.
|
|
|
| Report Abuse |
|
|
GFXdylan
|
  |
| Joined: 09 Feb 2013 |
| Total Posts: 679 |
|
| |
|
|
| 09 Mar 2014 10:12 AM |
What? That is nothing to do with the problem. |
|
|
| Report Abuse |
|
|
GFXdylan
|
  |
| Joined: 09 Feb 2013 |
| Total Posts: 679 |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 10 Mar 2014 02:40 PM |
| 'leaderstats' is a model... not a intvalue |
|
|
| Report Abuse |
|
|
|
| 10 Mar 2014 02:43 PM |
^ It can be whatever :P
Still, it has nothing to do with my actual issue. :[ |
|
|
| Report Abuse |
|
|
| |
|
LemmJuice
|
  |
| Joined: 23 Feb 2014 |
| Total Posts: 866 |
|
|
| 11 Mar 2014 11:48 AM |
Do you mean it's always 0? Because you seem to set it back to 0 a lot, make sure that it isn't being set to 0 after loading. |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 12:10 PM |
| No, it just doesn't ever save. I can have 5000 points, then get 6000, leave and come back, and I have 5000 again. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 12 Mar 2014 11:57 AM |
| are you creating new leaderstats every time someone joins the game? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 16 Mar 2014 05:48 AM |
player:SaveNumber("Points", 0)
-_- |
|
|
| Report Abuse |
|
|
|
| 16 Mar 2014 07:18 AM |
| You didn't read my issue. I'm not using data persistence. I'm check if they already saved by data persistence, clear that and SetAsync them. There point value is set by there GetAsync, which is nil. |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Mar 2014 01:34 PM |
Bumpy bump. I need a machine to bump this for me :/ |
|
|
| Report Abuse |
|
|
|
| 17 Mar 2014 03:57 PM |
| I wonder if those 200 views are mine. :o |
|
|
| Report Abuse |
|
|
| |
|