The points are saving. The carts are not. So basically when the player joins, I take all the carts that are in a folder, and make BoolValues for each of them into the player. When the player leaves, it checks which BoolValues are true (if their true the player purchased the cart) and inserts them into a table to be saved. When the player rejoins, if their's any carts in the table, once the BoolValues are created, it sets the BoolValues with the same name to true in the player. I don't see any errors in the output, but the carts do not save/load. I'm not sure which is the problem all I know is that when the player rejoins, their purchased carts aren't recognized. This is my first attempt with using DataStore, so I apologize if I made a rookie mistake.
local DataStore = game:GetService("DataStoreService") local dataPoints = DataStore:GetDataStore("testPoints") local cartSaves = DataStore:GetDataStore("testCartSaves") game.Players.PlayerAdded:Connect(function(plr) local cartsTable = {} local points = Instance.new("IntValue",plr) points.Name = "Points" points.Value = dataPoints:GetAsync(plr.UserId) or 0 local cartsFolder = Instance.new("Folder",plr) cartsFolder.Name = "Carts" local getCarts = cartSaves:GetAsync(plr.UserId) if getCarts then table.insert(cartsTable,getCarts) end for _,Carts in pairs(game.ReplicatedStorage.carts:GetChildren()) do local newBool = Instance.new("BoolValue",cartsFolder) newBool.Name = Carts.Name end if #cartsTable > 0 then for i = 1,#cartsTable do print(cartsTable[i]) if plr.Carts:FindFirstChild(cartsTable[i]) then plr.Carts:FindFirstChild(cartsTable[i]).Value = true end end end end) game.Players.PlayerRemoving:Connect(function(plr) dataPoints:SetAsync(plr.UserId,plr.Points.Value) local cartsSaveTable = {} for _,Cart in pairs(plr.Carts:GetChildren()) do if Cart.Value == true then table.insert(cartsSaveTable,Cart.Name) end end cartSaves:SetAsync(plr.UserId,cartsSaveTable) end)