Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I load a DataStore table properly using GetAsync?

Asked by
Oly_Xr 2
3 years ago

So I am trying to load a table that I saved in datastore, the problem is that it says that the table "LoadTable" is empty. And yes, the the DataStore table was saved correctly, so it is not empty, I checked in a DataStore manager plugin.

Here is the code:

local LoadTable = {}
        local success, errormessage = pcall(function()
            local data = SaveDataStore:GetAsync(Player.UserId.."_Progress_A") 

            for i,v in ipairs(data) do


                table.insert(LoadTable,#LoadTable+1,data[#data+1])  
                for i,v in ipairs(LoadTable) do
                    print(v)
                end
            end
        end)
0
im looking at "(Player.UserId.." rn, wheres the input for it? the function has no parameters, and the functions itself has no plr.userid being set, you literally don't have any input so nothing comes out, and there's no error message because it prints nothing because there's no input, from what i see. When you call this function, make it a paremeter called Player and call the function with the par AlexanderYar 788 — 3y
0
Oh no. That's in another part of the code. I forgot to mention that this is the only important part of the code, and also the part that I need help with. Everything does correspond to a variable and stuff. Oly_Xr 2 — 3y
0
Your table.insert is making my eyeballs hurt. Why are you inserting table values into a different table? Why not just iterate data. Also confirm API access is enabled. DinozCreates 1070 — 3y

Answer this question