This data store is supposed to save bool values inside a model called WeaponUpgrades. There are 8 boolValues total, yet this script only seems to be saving two of them. Can anyone help me figure out why?
game.Players.PlayerRemoving:connect(function(Player) local DataStore = game:GetService("DataStoreService"):GetDataStore(Player.userId.. "Weapons"); local statsStorage = Player:FindFirstChild("WeaponUpgrades"):GetChildren() for i = 1, #statsStorage do wait() DataStore:SetAsync(statsStorage[i].Name, statsStorage[i].Value) end end) game.Players.PlayerAdded:connect(function(Player) local DataStore = game:GetService("DataStoreService"):GetDataStore(Player.userId.. "Weapons") Player:WaitForChild("WeaponUpgrades") wait() local stats = Player:FindFirstChild("WeaponUpgrades"):GetChildren() for i = 1, #stats do wait(.1) stats[i].Value = DataStore:GetAsync(stats[i].Name) end end)