This is a test script to see if I can connect a string with a certain number while saving them. Red-1,White-2,Blue-3. saveData is nil, I don't understand why?
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)
for i = 1,#carts do
Save:SetAsync(player.userId,carts[i],test[i])
print("finished")
end
wait(3)
if saveData then
for i = 1,#saveData do
print(saveData[i])
end
end
end)
end)

1 comment
This is exactly what I've been looking for, thank you, I appreciate it.