Okay sorry if the title is confusing I’m pretty bad with datastores. So I just got DataStore2 to work and all I have is 2 leaderstats “Cash” and “Listeners” and it works fine. Although, I am going to need a lot more values to be saved that ALSO will being created through a player instance.
What I mean is I want a folder in the player called for instance “Collection” and the player will be able to add values to the “collection” for example a StringValue called “Disc” with the value being a song title. I want the folder to hold those anytime a player wants to add something new to the “collection”.
So is there a way to do this or save large amounts of data (I need several data values for player “Skill” level and “Ratings” etc.) through tables? I need the most efficient way possible. Sorry if this was confusing again I’m really not good or familiar with datastores.
Here is what I have for my datastore right now (I havent fully added in “Skill” yet):
local DataStore2 = require(1936396537)
DataStore2.Combine("MasterKey", "cash", "listeners", "skill")
local defaultCash = 5000
local defaultListeners = 0
local defaultskill = 1
game.Players.PlayerAdded:Connect(function(plr)
local cashDataStore = DataStore2("cash", plr)
local listenersDataStore = DataStore2("listeners", plr)
--folders
local leaderstats = Instance.new("Folder", plr)
leaderstats.Name = "leaderstats"
--leaderstat names
local cash = Instance.new("IntValue", leaderstats)
cash.Name = "Cash"
local listeners = Instance.new("IntValue", leaderstats)
listeners.Name = "Listeners"
--cash
local function cashUpdate(updatedValue)
cash.Value = cashDataStore:Get(updatedValue)
end
cashUpdate(defaultCash)
cashDataStore:OnUpdate(cashUpdate)
--listeners
local function listenersUpdate(updatedValue)
listeners.Value = listenersDataStore:Get(updatedValue)
end
listenersUpdate(defaultListeners)
listenersDataStore:OnUpdate(listenersUpdate)
end)