What are the point of datastore scopes?

local tempInven = game:GetService("DataStoreService"):GetDataStore("Inventory", "Temp")
local permInven = game:GetService("DataStoreService"):GetDataStore("Inventory", "Perm")


local tempInven = game:GetService("DataStoreService"):GetDataStore("TempInventory")
local permInven = game:GetService("DataStoreService"):GetDataStore("PermInventory")

Wouldn’t these two versions achieve the same results? What’s the main difference and why should I use one over the other in what situations?

Scopes in datastores serve more for an organisation purpose than functional purpose.

You can think of the main datastore, “Inventory”, as a folder. Inside that folder are sub-folders. These are your scopes (“Temp” and “Perm” in this case).

Scopes allow you to categorise data under one datastore instead of having multiple datastores. Also scopes help you to keep your code more organised and readable.

1 Like