If anyone could give me some help that'd be great, I haven't scripted in awhile and I forgot a few things about datastores, please help if you can.
Error:
07:41:37.793 - 104: Cannot store Dictionary in DataStore 07:41:37.794 - Stack Begin 07:41:37.794 - Script 'ServerScriptService.DataStore', Line 44 07:41:37.795 - Stack End
Code:
local dataService = game:GetService("DataStoreService"):GetDataStore("Alpha #1") game.Players.PlayerAdded:Connect(function(plr) local char = plr.Character or plr.CharacterAdded:wait() local stats = Instance.new("Folder", plr) stats.Name = "Stats" local money = Instance.new("NumberValue", stats) money.Name = "Money" money.Value = 500 local subscribers = Instance.new("NumberValue", stats) subscribers.Name = "Subscribers" local channel = Instance.new("StringValue", stats) channel.Name = "Channel" local characterCreated = Instance.new("BoolValue", stats) characterCreated.Name = "characterCreated" characterCreated.Value = false local hair = Instance.new("StringValue", stats) hair.Name = "Hair" local hairColor = Instance.new("Color3Value", stats) hairColor.Name = "HairColor" local shirt = Instance.new("StringValue", stats) shirt.Name = "Shirt" local pants = Instance.new("StringValue", stats) pants.Name = "Pants" local playerKey = plr.UserId .. "-key" local savedValues = dataService:GetAsync(playerKey) if not savedValues then local valuesToSave = {} for i,v in pairs(stats:GetChildren()) do valuesToSave[tostring(v.Name)] = v.Value end dataService:SetAsync(playerKey, valuesToSave) print("Successfully Saved Data!") else for i,v in pairs(savedValues) do stats[tostring(i)].Value = v end print("Successfully Loaded Data!") end end) game.Players.PlayerRemoving:Connect(function(plr) local playerKey = plr.UserId .. "-key" local valuesToSave = {} for i,v in pairs(plr.Stats:GetChildren()) do valuesToSave[tostring(v.Name)] = v.Value end dataService:SetAsync(playerKey, valuesToSave) print("Successfully Saved Data!") end)