Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

?Is it better to use a different key or a different datastore when saving different data

Asked by 3 years ago
Edited 3 years ago

Would it be better to save my pets data in a different key or different datastore than my stats.

Changing the key method:

local DataStore = game:GetService("DataStoreService"):GetDataStore("AllData")


-------------- When i save data ---------------
local Petskey = Player.UserId.."-pets" -- Need to add a string
local Statskey = Player.UserId.."stats"
DataStore:SetAsync(Petskey, statsdata)
DataStore:SetAsync(Statskey, petsdata)

Changing the datastore name method:

local DataStoreService = game:GetService("DataStoreService")
local StatsDataStore = DataStoreService:GetDataStore("StatsData")
local PetsDataStore = DataStoreService:GetDataStore("PetsData")


-------------- When i save data ---------------
local key = Player.UserId -- dont need to add a string
StatsDataStore:SetAsync(key, statsdata)
PetsDataStore:SetAsync(key, petsdata)

Which one is the most efficient.

Answer this question