How would I properly save and retrieve tables from a DataStore?
Here are the Variables
I assigned:
1 | local ds = game:GetService( "DataStoreService" ) |
2 | local ds 1 = ds:GetDataStore( "Vrank" ) |
3 | local ds 2 = ds:GetDataStore( "ARank" ) |
This is what I used to retrieve all the data saving into that table:
1 | local s, e = pcall ( function () |
2 | for i, v in ipairs (ds 1 :GetAsync( "VoteStarters" ,votePerms)) do |
3 | table.insert(votePerms, #votePerms+ 1 , v) |
Finally, the code that is supposed to insert and save new data into the table:
2 | if game.Players:FindFirstChild(args [ 2 ] ) then |
3 | local newRank = game.Players:FindFirstChild(args [ 2 ] ).UserId |
4 | table.insert(votePerms, #votePerms+ 1 , newRank) |
5 | local s, e = pcall ( function () |
6 | ds 1 :SetAsync( "VoteStarters" ,votePerms) |
Thank you for taking the time to read this!