saveAs = "Version BETA"
dataStore = game:GetService("DataStoreService"):GetDataStore(saveAs)
game.Players.PlayerRemoving:connect(function(player) player:WaitForDataReady() wait(1) tats = player["leaderstats"]:GetChildren() for i = 1, #tats do dataStore:SetAsync(tats[i].Name,tats[i].Value) end end)
game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() wait(1) tats = player["leaderstats"]:GetChildren() for i = 1, #tats do tats[i].Value = dataStore:GetAsync(tats[i].Name) end end)
game.Players.ChildAdded:connect(function(player) local main = Instance.new("Model") main.Parent = player main.Name = "ToolsUnlocked"
local tool1 = Instance.new("BoolValue") tool1.Parent = main tool1.Name = "Dirt" tool1.Value = false
local tool2 = Instance.new("BoolValue") tool2.Parent = main tool2.Name = "Dirt" tool2.Value = false
end)
I'm trying to save the tools called 'Dirt' and 'Rock' into the inventory but its not working. I think there is something wrong with spawning the tools into the inventory.
