|
| 03 Jun 2014 09:50 AM |
| How do I make sure that the default data isn't overwritten when I save via DataStore? Also, which Data system is better for saving data when players leave/join, DataStores or Data Persistence? |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Jun 2014 11:24 AM |
DataStore is more reliable. It only updates when SetAysnc is called. If a server crashes and uses Data Persistence.. You lose all the Data for that current session.
You could use the .Changed event to SetAsync, which will update the players data.. When they join again, it should be set to the latest one.
If it doesnt load, perhaps try adding a wait inside the Data Store script.. You might be changing a value inside another script, causing problems with Data Store. |
|
|
| Report Abuse |
|
|
|
| 03 Jun 2014 11:48 AM |
| How would I use the .Changed event with DataStores? Could you give me an example? |
|
|
| Report Abuse |
|
|
|
| 03 Jun 2014 12:42 PM |
points.Changed:connect(function(Val) DataStore:SetAsync("Points_"..player.Name, Val) end) |
|
|
| Report Abuse |
|
|
| |
|
|
| 03 Jun 2014 05:35 PM |
| No problem, I had loads of trouble with Data Store.. Glad I could help. |
|
|
| Report Abuse |
|
|
|
| 07 Jun 2014 03:30 PM |
Sorry one last question (I know this post is old, sorry about that)
I read on the Wiki that using SetAsync and GetAsync to modify DataStore values is bad, and that you should use UpdateAsync and IncrementAsync. However, why it's bad is if several servers modify the same value at once, but with saving/loading when Players join/leave, that won't happen, so is it ok? |
|
|
| Report Abuse |
|
|