With my house datastore I keep running into this error
DataStore request was added to queue. If request queue fills, further requests will be dropped. Try sending fewer requests.Key (Numbers)
Here is the data saving script
Any help would be much appreciative
local DataStoreService = game:GetService("DataStoreService")
local MainData = DataStoreService:GetDataStore("MainData")
local HouseData = DataStoreService:GetDataStore("HouseData")
--Variables--
function saveHouseData(player)
local Houses = {}
for i, value in pairs(player.Houses:GetChildren()) do
Houses[value.Name] = value.Value
end
HouseData:SetAsync(player.UserId, Houses)
end
--House Data--
game.Players.PlayerAdded:Connect(function(player)
local Plot = Instance.new("StringValue")
Plot.Name = "Plot"
Plot.Value = ""
Plot.Parent = player
local Houses = Instance.new("Folder")
Houses.Name = "Houses"
Houses.Parent = player
for i, house in pairs(game.ReplicatedStorage.Houses:GetChildren()) do
local newValue = Instance.new("BoolValue")
newValue.Name = house.Name
newValue.Value = false
newValue.Parent = Houses
end
local houseData = HouseData:GetAsync(player.UserId) or {}
for houseName, houseValue in pairs(HouseData)
Houses[houseName].Value = houseValue
end
end)
--House Saving--
game.Players.PlayerRemoving:Connect(function(player)
if game.Workspace:FindFirstChild(player.Name.."'sHouse") then
game.Workspace:FindFirstChild(player.Name.."'sHouse"):Destroy()
end
local PlayerPlot = player.Plot
game.Workspace:FindFirstChild(PlayerPlot.Value).CurrentOwner.Value = ""
player.Plot.Value = ""
end)
game.Players.PlayerRemoving:Connect(saveHouseData)
game:BindToClose(function()
for i, player in pairs(game.Players:GetPlayers()) do
saveHouseData(player)
end
end)