Datastorage issues

Is there a datastorage tutorial that explains all of this? And that it’s really understandable?

I’d like to learn how to save values and save game objects, but I don’t know how to do it. Any idea where to start?

I would appreciate it if someone could share commented code with me, that would be very helpful. :frowning:

1 Like

Well you have the official roblox documentation:

You have examples of usage in it.

2 Likes

Did you use search before making this topic?
There are tons of these topics all around devforum.

2 Likes

Yes, I’ve searched for some post and in the documentation, that’s why I’m post here now to see if anyone could share links or more information about it

There are a plethora of YouTube videos that can help you. I haven’t watched this video by TheDevKing since it’s creation so I do not know how accurate it is today. But, almost all of the information should still be relevant. As Omega77073 posted the official Roblox documentation is the best source of information but many require a visual explanation of someone doing it than just reading it.

1 Like

What is not understandable on API or community posts that goes really in depth?

1 Like

The most basic about this service:

The DataStore service is divided into two, normal DataStore and OrderedDataStore, both can save and load information that must be string, boolean, tables or numbers.

First you must “find” the “folder” of the data, this is done like this:

local DSS = game:GetService("DataStoreService")
DSS:GetDataStore(Name,Scope)
DSS:GetOrderedDataStore(Name,Scope)

Name is the “folder” and Scope is a subfolder in Name, Scope needs to be defined if you don’t want.

The most basic, to obtain a data use :GetAsync() and to save it use :SetAsync() and to remove it use :RemoveAsync().

There are other properties you can use like: UpdateAsync() and :IncrementAsync().
UpdateAsync: returns the old value and saves the new one you put.
IncrementAsync: it only works with numbers, add the number you put in and return the new value.

Use pcall to catch errors, such as nil values.

More information: Datastore Tutorial for Beginners

1 Like

You forgot most useful UpdateAsync() :crazy_face:.

1 Like

Whoops, the post has not been updated yet :rofl:

2 Likes