The :Save() function no longer exists in DataStore2?
Actually, I just read through the api, and you are actually gonna wanna use :Set() instead of :Save(). DataStore2 already saves when the player leaves, so your code would be useless. Here is documentation:
https://kampfkarren.github.io/Roblox/api/#datastoreset
PS @Beastcraft_Gaming :Save() is a function, he was just using it improperly. Please check api and other reliables sources before telling people information
Also :Save() does not have any parameters. It just saves what is cached with :Set()
DataStore2:Set(dataTools)
Still returns the same error. Is there a different function I’m supposed to use for saving tables? I know this function works for saving strings.
I don’t think you call the function on DataStore2, rather the datstore being returned with :Get()
So you would do:
local data = plr:Get(DefaultValueIfAny)
data:Set(dataTools)
It’s as character efficient as your serializers are, but unless you’re doing something really really out there, you will never ever ever have to think about the character limit.
Also what if I wanted to use my datastore editor on this? What would the key be and what would the datastore name be?
Search “DataStore2 data store editor” on the forums.
You’re not on the latest version of DataStore2. The free model does not have SaveAll and is not officially recommened anywhere. Update to the latest version as per the documentation.
I switched to the most updated version, but now DataStore2.SaveAll(plr)
just returns a different error and still does not save the table.
“DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = 345”
There is problem in your script I am seeing now.
You’re using datastore2 the wrong way. You should update the datastore when giving item and listen to the callback to give the item to the player etc and not the other way around, what you are doing is updating the inventory table of player and saving it when the player leaves.
I recommend looking into this post of mine.
Is there currently a way to get the data of players who are not in the game? This is for the purpose of unbanning and banning players using commands who are not in the same game as you. You’d need to load the data, change it and then save it all while the player may not be in the game. Is this possible?
If you want to get datastore of a player who isn’t in the server, I don’t think its possible as DataStore2 is attached to the player instance.
- You can either use normal DataStore.
- Or use ProfileService by @loleris
Took a while to get the hang of it, but now that I know how to use it, it has a lot more functionality than just the regular DataStoreService. I wish I used this sooner, it would’ve made everything so much easier to do.
May I ask why you’ve said that you do not officially recommend using SaveAll anywhere but it’s still said to be the recommended way of saving combined data stores on your API docs?
May I ask why you’ve said that you do not officially recommend using SaveAll anywhere
Have I said this? I’d need to know the context behind this.
This sentence is an abbreviated way of saying, “The free model does not have SaveAll, and the free model is not officially recommended anywhere.”
I have a few questions concerning datastore2.
- Can the “combine” save two of the same-named objects?
- Does the “combine” affect anything within ServerStorage?
- Are there any other things that I should know about (i.e specific case scenarios.)
yikes, my bad sorry for the trouble.
How would I save multiple values in one store? Would I just make multiple CoinsUpdated functions? Also, should I require the actual module or the Id of the module?
I don’t know what you mean.
No, I don’t know why it would.
Read the documentation.