I have seen many people who do the DataStore in 2 different types and I’m not sure which is the best practice.
A single DataStore for all the players
local DataStoreService = game:GetService(”DataStoreService”)
local Players = game: GetService ("Players")
local gamedata = DataStoreService:GetDataStore("Data")
Players:PlayerAdded:Connect(function(Player)
local success, val = pcall(function()
gameData:GetAsync(Player.UserId)
end)
-- code
end)
And
2. Using a seperate DataStore for every player
local DataStoreService = game:GetService(”DataStoreService”)
local Players = game: GetService ("Players")
Players:PlayerAdded:Connect(function(Player)
local playerData = DataStoreService:GetDataStore(Player.UserId)
local success, val = pcall(function()
playerData.GetAsync("whatever")
end)
-- code
end)
Which way is the best practice?
Creating a single DataStore for all the players
Or
A single DataStore for all players will definitely be better, there isn’t any reason to create one for every player that I’m aware of, if anything that’s bad practice.
DataStore 2 was a good way to make versioned datastores before ROBLOX actually added them themselves, not worth using it now since it’ll only slow things down.