So, I need help, this data store script is now working for some reason!
Folder is in "StarterCharacterScripts" The folder has some values in them that are inserted when bought.
I added this following script in the "Workspace":
game.Players.PlayerRemoving:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats") --Player's key. local statstorage = player.Character:WaitForChild("PlayerSkins"):GetChildren() for i = 1, #statstorage do datastore:SetAsync(statstorage[i].Name, statstorage[i].Value) end end) game.Players.PlayerAdded:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats") player:WaitForChild("PlayerSkins") wait(1) local stats = player.Character:WaitForChild("PlayerSkins"):GetChildren() for i = 1, #stats do stats[i].Value = datastore:GetAsync(stats[i].Name) end end)
Everytime I click a button to buy a skin (Wich adds the value to the folder with the id of the skin in it and it works fine. But when I leave the game and come back, it simply doesn't save and my values aren't in the folder. Can someone help me with this? I'd be really apreciated!