I'm not great with datastores, but I've been having an issue with my game saving. Whenever I add a value to myself and leave I get a warning: DataStore request was added to queue. If request queue fills, further requests will be dropped. Here is my script:
local DataStoreService = game:GetService("DataStoreService")
local PlayerData = DataStoreService:GetDataStore("General")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
MakeStats(player)
end)
wait(0.5)
print("e")
LoadData(player)
end)
game.Players.PlayerRemoving:Connect(function(player)
SaveData(player)
end)
function MakeStats(player)
if player:FindFirstChild("playerstats") == nil then
local PlayerFolder = Instance.new("Folder",player)
PlayerFolder.Name = "playerstats"
local PlayerCash = Instance.new("NumberValue",PlayerFolder)
PlayerCash.Name = "Cash"
local PlayerBxp = Instance.new("NumberValue",PlayerFolder)
PlayerBxp.Name = "BadXP"
local PlayerGxp = Instance.new("NumberValue",PlayerFolder)
PlayerGxp.Name = "GoodXP"
end
end
function LoadData(player)
local cashdata = PlayerData:GetAsync(player.UserId,"cash")
local badxp = PlayerData:GetAsync(player.UserId,"badxp")
local goodxp = PlayerData:GetAsync(player.UserId,"goodxp")
local PlayerFolder = player:WaitForChild("playerstats")
local PlayerCash = PlayerFolder.Cash
local PlayerBxp = PlayerFolder.BadXP
local PlayerGxp = PlayerFolder.GoodXP
PlayerCash.Value = cashdata
PlayerBxp.Value = badxp
PlayerGxp.Value = goodxp
end
function SaveData(player)
local PlayerFolder = player:WaitForChild("playerstats")
local PlayerCash = PlayerFolder.Cash
local PlayerBxp = PlayerFolder.BadXP
local PlayerGxp = PlayerFolder.GoodXP
PlayerData:SetAsync(player.UserId,"cash",PlayerCash.Value)
PlayerData:SetAsync(player.UserId,"badxp",PlayerBxp.Value)
PlayerData:SetAsync(player.UserId,"goodxp",PlayerGxp.Value)
end
I don't see what I'm doing wrong, but if anyone could help that would be appreciated! Thanks!

4 comments
Thats a problem on Roblox's end I believe.
That means it's receiving too much to save. You may need to split up the saves between different datastores
I see, I tried that and it worked. Thank you
I mean as the above you could have used JSONEncode and saved it as a string but /shrugemote