local Storage = game:GetService('DataStoreService'):GetDataStore('SkinsHolder') game.Players.PlayerAdded:Connect(function(player) local skins = game.ServerStorage.Lazors:Clone() skins.Parent = player local savedskins = Storage:GetAsync(player.userId .. "-Skins") if savedskins ~= nil then for i,v in pairs(skins:GetChildren()) do v.Value = savedskins end end end) game.Players.PlayerRemoving:connect(function(player) local id = player.userId for i,v in pairs(player.Lazors:GetChildren()) do local skinsvalue = v.Value for i,v in pairs(player.Lazors:GetChildren()) do Storage:SetAsync(id.. "-Skins",skinsvalue) end end end)
Its supposed to save the values(which are bool values) and load them if they are true or false. Why will this not work?
Your problem is that you are setting the value for all of them with the value from one skin. The best way to fix this is to use a table in a fashion somewhat like this:
local Storage = game:GetService('DataStoreService'):GetDataStore('SkinsHolder') game.Players.PlayerAdded:Connect(function(player) local skins = game.ServerStorage.Lazors:Clone(); skins.Parent = player; local savedskins = Storage:GetAsync(player.UserId .. "-Skins"); if savedskins == nil then warn("Data not found"); else for i,v in pairs(skins:GetChildren()) do v.Value = savedskins[i]; end; end; end); game.Players.PlayerRemoving:connect(function(player) local id = player.UserId; local skins = {}; for i,v in pairs(player.Lazors:GetChildren()) do table.insert(skins, i, v.Value); -- This inserts into the skins table and sets the value of v to i (the index of the object) end; Storage:SetAsync(id.. "-Skins", skins); end);
I hope this helped. If it did please accept this as the answer. If you are still confused or just need help with other scripts feel free to message me and ask.