Heres my script,
local carts = { ["red"] = 1, ["white"] = 2, ["blue"] = 3 } local DSService = game:GetService('DataStoreService') local Save = DSService:GetDataStore('Carts1') game.Players.PlayerAdded:connect(function(player) pcall(function() player:WaitForChild("PlayerGui") local saveData = Save:GetAsync(player.userId) Save:SetAsync(player.userId,carts) print("Done!") wait(4) if saveData then print("Done") print(saveData) end end) end)
Output-
23:31:09.115 - RC2 Testing was auto-saved Done! Done table: 2EF00F94
How do I get the table out of the data save using :SetAsync? All I'm getting is that output.
To create an IntValue from all values in the table, you can go:
for i,v in pairs(saveData) do local val = Instance.new("IntValue") val.Value = v val.Name = i val.Parent = ... end
Or to get the value for a specific colour, you can go:
print(saveData["white"]) --> 2