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

DataStore not saving/loading table for some reason?

Asked by 6 years ago

I have this script in the workspace:

script:WaitForChild("SaveTableValues").OnServerEvent:connect(function(player)

    local datastore = game:GetService("DataStoreService"):GetDataStore("BannedPlayers")

for i =  1, #BannedPeople do
    datastore:SetAsync(BannedPeople[i],BannedPeople[i])
    print(BannedPeople[i].." successfully saved!")
end
end)



script:WaitForChild("LoadTableValues").OnServerEvent:connect(function(player)
    local datastore = game:GetService("DataStoreService"):GetDataStore("BannedPlayers")

    for i = 1, #BannedPeople do     
table.insert(BannedPeople,datastore:GetAsync(BannedPeople[i]))  
print(BannedPeople[i].." successfully loaded!")  
        end
end)

Everytime I leave it won't load when I call the LoadTableValues Event for some reason.. But the save Event works.

Can someone help?

Answer this question