Whenever I use any type of datastore, I get this error:
10:46:41.145 - 508: Exhausted all retries for key: %s
I don't know whats wrong? Anyone know? Here is my script:
local Data = game:GetService("DataStoreService"):GetDataStore("Data0")
local prefix = "user_" -- example prefix
game.Players.PlayerAdded:connect(function(player)
local folder = Instance.new("Folder", player)
folder.Name = "leaderstats"
local Kills = Instance.new("IntValue",folder)
Kills.Name = "Kills"
local Credits = Instance.new("IntValue",folder)
Credits.Name = "Credits"
local plrData = Data:GetAsync(prefix .. tostring(player.UserId))
if plrData then
Kills.Value = plrData[1] or 0
Credits.Value = plrData[2] or 0
else
-- most people like to save the data if they have none
Data:SetAsync(prefix .. tostring(player.UserId), {
Kills.Value,
Credits.Value
})
end
end)
game.Players.PlayerRemoving:connect(function(player)
Data:SetAsync(prefix .. tostring(player.UserId), {
player.leaderstats.Kills.Value,
player.leaderstats.Credits.Value
})
end)

10 comments
https://devforum.roblox.com/t/508-exhausted-all-retries-for-key-s-string-datastore-error-happens-when-i-havent-gone-over-my-limits/230966/15
Is the problem on line 508 trying to save data? If so roblox studios doesent really do that. So what I usally do is locate the line that saves it to the bottom.
Its the bottom line. When the player is removing.
Are the leaderstats showing up though?
Yeah
It should be fine then, It will save ingame but not in studios.
Ok. Thank you. Let me see if it works.
Don't exactly understand the question but you should set the parent of the instance.new objects on another line instead of the second argument and you should use Connect instead
of connect
Use Connect instead of connect and not entirely sure why you're doing tostring(player.UserId), I normally just do "Stats-"..player.UserId