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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 05 Jul 2015 07:09 AM |
yup, tell him, it will really help...
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|