Is "scope" useful in GetDataStore(name, scope, opt)?

local ds1 = DataStoreService:GetDataStore("Name", "Scope1")
ds1:SetAsync("Key", "Value")

local ds2 = DataStoreService:GetDataStore("Name", "Scope2")
ds2:SetAsync("Key", "Value")

-------------------------------------------------------------

local ds = DataStoreService:GetDataStore("Name")
ds:SetAsync("Scope1", {Key = "Value"})
ds:SetAsync("Scope2", {Key = "Value"})

I don’t see any benefit of using scope, but it makes me need to get datastore once more

1 Like

I don’t know if it’s a bad practice, but i usually use an array for this and a loop for. Even if you didn’t have a scope, you still have to do the task two times.
I don’t think that “scope” makes the tasks related to data management easier and simple. I think, the purpose of “scopes” is similar to folder. If you want to name a data “score” this data can be everywhere.

iirc scopes are in the process of being phased out. you’re better off just prefixing keys with the scope, i.e. use `{scope}_{key}` as the key, rather than the scope argument.

1 Like