I'm making a test DataStore script where I have 2 tables and save them using :SetAsync. Then I try to print their data out, the first one prints correct, when I get to the second one, it prints the data for the first one and along with 2 nil's.
carts = {"Red", "White", "Blue"} test = {1,2,3} local DSService = game:GetService('DataStoreService') local Save = DSService:GetDataStore('Test') game.Players.PlayerAdded:connect(function(player) pcall(function() player:WaitForChild("PlayerGui") local saveData = Save:GetAsync(player.userId) Save:SetAsync(player.userId,carts,test) print("Done!") wait(4) if saveData then for i = 1,#saveData[1] do print(saveData[i]) end wait(2) for x = 1,#saveData[2] do print(saveData[x]) end end end) end)
When it gets saveData[1] my output is
Done! Red White Blue
When it gets to saveData[2] my full output is
12:53:36.930 - RC2 Testing was auto-saved Done! Red White Blue Red White Blue nil (x2)
How do I fix the nil's?