generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Driving me nuts

Previous Thread :: Next Thread 
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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 is not online. GFXdylan
Joined: 09 Feb 2013
Total Posts: 679
09 Mar 2014 10:06 AM
re-do the badge part.
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
09 Mar 2014 10:12 AM
What?
That is nothing to do with the problem.
Report Abuse
GFXdylan is not online. GFXdylan
Joined: 09 Feb 2013
Total Posts: 679
09 Mar 2014 10:14 AM
Ik, but idk y xd\
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
09 Mar 2014 11:09 AM
Bump
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
09 Mar 2014 11:57 AM
Bumpity Bump
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
09 Mar 2014 12:26 PM
Bumpers Cars
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
10 Mar 2014 12:51 PM
Bump the bump
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
10 Mar 2014 01:53 PM
D:
Report Abuse
MountainSnow is not online. MountainSnow
Joined: 15 Mar 2013
Total Posts: 3324
10 Mar 2014 02:40 PM
'leaderstats' is a model... not a intvalue
Report Abuse
iNerdGamer is not online. iNerdGamer
Joined: 20 Feb 2014
Total Posts: 7
10 Mar 2014 02:43 PM
^ It can be whatever :P

Still, it has nothing to do with my actual issue. :[
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
11 Mar 2014 11:40 AM
Annnnddddd.... bump.
Report Abuse
LemmJuice is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
11 Mar 2014 05:01 PM
D
Dd
Ddd
Drop the bump
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
12 Mar 2014 11:38 AM
:(
Report Abuse
janthran is not online. 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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
15 Mar 2014 03:15 PM
^ What you mean?

Bump :[
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
16 Mar 2014 05:11 AM
Bump :'(
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
16 Mar 2014 05:48 AM
player:SaveNumber("Points", 0)


-_-
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
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
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
16 Mar 2014 03:03 PM
Anyone :(
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
17 Mar 2014 01:34 PM
Bumpy bump.
I need a machine to bump this for me :/
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
17 Mar 2014 03:57 PM
I wonder if those 200 views are mine. :o
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
18 Mar 2014 03:21 PM
B b b b b b BUMP!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image