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 » Scripters
Home Search
 

Any idea why this won't work? [Datastore]

Previous Thread :: Next Thread 
MezornoIV is not online. MezornoIV
Joined: 20 Jul 2010
Total Posts: 2276
09 Nov 2016 11:32 AM
I don't get any errors in studio, in the actual ROBLOX place it says "World is not a valid member of leaderstats", but in studio, when I view the players leaderstats it's there? Anyone get this before?


local ds = ga################################################################s2 = ga#########################################################local ds3 = ga############################################################################################################## local stats = Instance.new("IntValue", player)
stats.Name = "leaderstats"
local world = Instance.new("IntValue", stats)
world.Name = "World"
local stage = Instance.new("IntValue", stats)
stage.Name = "Stage"
local coins = Instance.new("IntValue", stats)
coins.Name = "Coins"
end)


wait(1) --To insure that everything works before it tries to set stats

game.Players.PlayerAdded:connect(function(plr)
--KEYS
local key = "User_"..plr.UserId
local key2 = "User1_"..plr.UserId
local key3 = "User2_"..plr.UserId
--KEYS

--OLD STATS
local oldWorld = ds:GetAsync(key)
local oldStage = ds2:GetAsync(key2)
local oldCoins = ds3:GetAsync(key3)
--OLD STATS

--LOAD STATS
if oldWorld then
plr.leaderstats.World = oldWorld
else
plr.leaderstats.World = 1
end
if oldStage then
plr.leaderstats.Stage = oldStage
else
plr.leaderstats.Stage = 1
end
if oldCoins then
plr.leaderstats.Coins = oldCoins
else
plr.leaderstats.Coins = 0
end
--LOAD STATS
end)


Report Abuse
MezornoIV is not online. MezornoIV
Joined: 20 Jul 2010
Total Posts: 2276
09 Nov 2016 11:38 AM
#############################################################################################
Report Abuse
MezornoIV is not online. MezornoIV
Joined: 20 Jul 2010
Total Posts: 2276
09 Nov 2016 11:41 AM
ROBLOX has really done this time with the #ing. Especially if I'm only posting code with functions that they endorse on their wiki and website.


Report Abuse
MezornoIV is not online. MezornoIV
Joined: 20 Jul 2010
Total Posts: 2276
09 Nov 2016 11:51 AM
b


Report Abuse
Briicks is online. Briicks
Joined: 03 Apr 2015
Total Posts: 1796
09 Nov 2016 11:55 AM
Don't use multi keys, use a table, and set all your values in the table...
Also not 100% but from doing it the other day, don't add that wait before playeradded event, maybe inside it.

If you cant do the tables, make it a model and post link and i'll make it a table for you.

Instant Profit Finder: https://www.roblox.com/games/486614503/SFPF
Report Abuse
MezornoIV is not online. MezornoIV
Joined: 20 Jul 2010
Total Posts: 2276
09 Nov 2016 11:59 AM
The wait didn't work, here's the model: https://www.roblox.com/item.aspx?id=541287481



Report Abuse
LegomasterNiko is not online. LegomasterNiko
Joined: 27 Feb 2013
Total Posts: 1176
09 Nov 2016 12:34 PM
Making data store are really hard, because they never function
Report Abuse
MezornoIV is not online. MezornoIV
Joined: 20 Jul 2010
Total Posts: 2276
09 Nov 2016 12:45 PM
Works In-Game thanks!


Report Abuse
DevVince is not online. DevVince
Joined: 08 Nov 2008
Total Posts: 9245
09 Nov 2016 12:48 PM
You should take this and see how it works, it might help. :)

https://www.roblox.com/library/438429848/DataStore-Leaderstats
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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