Hello! I get this warning:
DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key = tablesave
There are more than 100 strings inside the table.
Is normal Data Store not good for this stuff? Or is there any other solutions?
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("10")
local IDs = {}
local serverStarted = false
game.Players.PlayerAdded:Connect(function(player)
if not serverStarted then
serverStarted = true
local success, id = pcall(function()
return DataStore:GetAsync("tablesave")
end)
if success and id then
for i, userId in pairs(id) do
table.insert(IDs, userId)
end
print("Loaded IDs: "..#IDs)
elseif not success then
warn("Failed to fetch IDs: " .. id)
end
end
end)
local function saveIDs()
local success, errorMessage = pcall(function()
DataStore:SetAsync("tablesave", IDs)
IDs = {}
local id = DataStore:GetAsync("tablesave")
if id then
for i, userId in pairs(id) do
table.insert(IDs, userId)
end
print("Loaded IDs: "..#IDs)
end
end)
if success then
print("Saved Data")
else
warn("Error: " .. errorMessage)
end
end
game.Players.PlayerRemoving:Connect(function(player)
saveIDs()
end)
game:BindToClose(function()
for _, player in pairs(game.Players:GetPlayers()) do
saveIDs()
end
end)