The problem is i'm still new at this and i don't know if it doesn't save or if it doesn't load or maybe both so i could really use some help with it. Here's the script:
--Variables-- local DataBaseStore = game:GetService("DataStoreService"):GetDataStore("AllTheStatsAreHere") local Statsholder = script.Stats game.Players.PlayerAdded:Connect(function(NewPlayer) local key = "Player-ID:" .. NewPlayer.UserId local GetSave = DataBaseStore:GetAsync(key) local DataBaseFolder = Instance.new("Folder", NewPlayer) DataBaseFolder.Name = "PlayerStats" for i, Stats in pairs(Statsholder:GetChildren()) do local NewStats = Instance.new(Stats.ClassName) NewStats.Name = Stats.Name NewStats.Value = Stats.Value NewStats.Parent = DataBaseFolder end if GetSave then for i, Stats in pairs(script.Stats:GetChildren()) do DataBaseFolder[Stats.Name].Value = GetSave[i] print(i, Stats.Name, Stats.Value) end else -- Save Stats local StatsToSave = {} for i, Stats in pairs(DataBaseFolder:GetChildren()) do table.insert(StatsToSave, Stats.Value) print(i, Stats.Name, Stats.Value) end DataBaseStore:SetAsync(key, StatsToSave) end while wait(30) do --Autosave local StatsToSave = {} for i, Stats in pairs(DataBaseFolder:GetChildren()) do table.insert(StatsToSave, Stats.Value) print(i, Stats.Name, Stats.Value) end DataBaseStore:SetAsync(key, StatsToSave) end game.Players.PlayerRemoving:Connect(function(OldPlayer) local key = "Player-ID:" .. OldPlayer.UserId local StatsToSave = {} for i, Stats in pairs(DataBaseFolder:GetChildren()) do table.insert(StatsToSave, Stats.Value) print(i, Stats.Name, Stats.Value) end DataBaseStore:SetAsync(key, StatsToSave) end) end)