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
 

Re: Datastores wtf

Previous Thread :: Next Thread 
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
05 Jul 2015 06:17 AM
Everybody keeps having problems with them

It also seems strange to use datastores with what the old data persistence was for - saving a player's stats, because of datastore's data/req limit, and cause it seems it was more designed for things like cross server chat, leaderboards, etc.

People in my friends game keep losing data, and I keep seeing threads here about datastores.

Should we be using data persistence for saving players' data? I haven't experienced any problems with data stores yet but assuming they weren't just because n00bs, I vote yes
Report Abuse
Locard is not online. Locard
Joined: 13 Apr 2014
Total Posts: 3516
05 Jul 2015 06:19 AM
Your friend isn't saving them correctly if his players are losing data. Data store is more reliable if it's scripted correctly.
Report Abuse
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
05 Jul 2015 06:21 AM
define 'scripted correctly'. He loads their data when they join - properly by my eyes, and on PlayerRemoving he saves. I couldn't see anything wrong with his method.

Before you hit me up with that "save periodically in case" crap, well if you have to do that it isn't so reliable is it? With data persistence you could save when they were leaving and it would work every time.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
05 Jul 2015 06:25 AM
You should not be using Data Persistence over Data Stores without a good reason. Data Persistence used a different storage and serialization method, and it's being phased out anyway. If you're losing data, you're saving it wrong.

function game.OnClose() wait(10) end;
Report Abuse
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
05 Jul 2015 06:27 AM
So do you have a popular game that uses data stores where nobody has lost data?
Report Abuse
Bobbybillyhi is not online. Bobbybillyhi
Joined: 10 Apr 2012
Total Posts: 287
05 Jul 2015 06:27 AM
As far as I am aware, PlayerRemoving would not work with leaderstats, since it is called after/as the player has left. I would therefore recommend a DataStores script.
Report Abuse
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
05 Jul 2015 06:30 AM
I'm almost certain he is saving his data correctly. Beyond his saving/loading I haven't looked into his game, but I doubt it's something else causing the loss.

When the player enters, he loads the data from player name .. "-" .. player ID, when the player leaves he takes the data and saves it.

The only thing that might be wrong is that he doesn't have an operation queue to wait for saving/loading if the limit is being reached, but with 10 reqs/player/minute allowed, I doubt that's the problem.
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
05 Jul 2015 06:56 AM
1. Player.Name isn't reliable since people can change their name.
2. PlayerRemoving, huh? Delay the shutdown of the server cos if it's the last player then the game wont get the chance to save their data, I have experienced this.

"My Life is going Good... but..."
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
05 Jul 2015 07:05 AM
You could probably save some other way besides using playerremoving, then check after it "saved" to see if it really did save (compare data from datastore to current data) and if not tell the player they need to save again.
Report Abuse
Alyte is not online. Alyte
Joined: 24 Oct 2011
Total Posts: 10090
05 Jul 2015 07:06 AM
1. Player.Name isn't reliable since people can change their name.

Good point !! I will tell my friend
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
05 Jul 2015 07:09 AM
yup, tell him, it will really help...

"My Life is going Good... but..."
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
05 Jul 2015 07:11 AM
Whenever the leaderstat is changed, store it in a table (in the datastore script), called something like 'PlayerData'.

local PlayerData = {}
local Key = "User_"..player.userId
PlayerData[Key].Kills = player.leaderstats.kills

Something like that, and then save the PlayerData values. Not the ones under the player.

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
Kapitanovas is not online. Kapitanovas
Joined: 09 Sep 2012
Total Posts: 4216
05 Jul 2015 08:09 AM
use this...
http://www.roblox.com/DataStore-Module-item?id=266064219
made it a few mins ago... I need testers...
just use it like so
local DataStorage = require(266064219)
and then just use whatever...
DataStorage.StoreData(plr, dataName, data)
or whatever...
tell me if there are any errors...

"My Life is going Good... but..."
Report Abuse
Trioxide is not online. Trioxide
Joined: 29 Mar 2011
Total Posts: 32902
05 Jul 2015 09:07 AM
I could release my saving module at some point:

require(module id)()
local player = Paragon.new(player)
player:Load() -- loads leaderstats
player:Save() -- saves 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