Hey guys! I would like my Level save data to be put into a table as I'll have like 20-25 levels. Now the there is 3 save data. 1 and 2 should be ignored now. save data 3 is the one responsible for saving LevelOne's data. and I would like to make save data 3 a table to be able to save many level's boolvalue. Could you please help? I looked it up and I don't understand how can I make a table out of save datas. Thank you so much!
local datastore = game:GetService("DataStoreService") local ds1 = datastore:GetDataStore("CompleteSaveSystem") local ds2 = datastore:GetDataStore("TTSaveSystem") local ds3 = datastore:GetDataStore("LevelTrack") game.Players.PlayerAdded:connect(function(plr) local folder = Instance.new("Folder", plr) folder.Name = "leaderstats" local Complete = Instance.new("IntValue", folder) Complete.Name = "Completes" local TT = Instance.new("IntValue", folder) TT.Name = "Tree Tokens" local folder2 = Instance.new("Folder", plr) folder2.Name = "LevelTracking" local LevelOne = Instance.new("BoolValue", folder2) LevelOne.Name = "LevelOne" Complete.Value = ds1:GetAsync(plr.UserId) or 0 ds1:SetAsync(plr.UserId, Complete.Value) TT.Value = ds2:GetAsync(plr.UserId) or 0 ds2:SetAsync(plr.UserId, TT.Value) LevelOne.Value = ds3:GetAsync(plr.UserId) ds3:SetAsync(plr.UserId, LevelOne.Value) Complete.Changed:connect(function() ds1:SetAsync(plr.UserId, Complete.Value) end) TT.Changed:connect(function() ds2:SetAsync(plr.UserId, TT.Value) end) LevelOne.Changed:connect(function() ds3:SetAsync(plr.UserId, LevelOne.Value) end) end)
If you're simply just asking how to save data as a table that is it.
local data = {LevelOne = LevelOne.Value} ds3:SetAsync(plr.UserId, data)