Just.. What?
As you saw in the title,
Roblox has been treating datastores pretty weirdly right now..
I got this error, and i’ll be completely honest, i don’t think this is my fault. Here is the code:
local dss = game:GetService("DataStoreService")
local coinsData = dss:GetDataStore("CoinsData")
local winsData = dss:GetDataStore("WinsData")
local stickersData = dss:GetDataStore("StickersData")
local stickersFolder = script.Parent.Stickers
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local coins = Instance.new("IntValue")
coins.Name = "Coins"
coins.Parent = leaderstats
local success, currentCoins = pcall(function()
return coinsData:GetAsync("Coins_"..player.UserId)
end)
if success then
coins.Value = currentCoins or 0
else
coins.Value = 0
end
local wins = Instance.new("IntValue")
wins.Name = "Wins"
wins.Parent = leaderstats
local success2, currentWins = pcall(function()
return winsData:GetAsync("Wins_"..player.UserId)
end)
if success2 then
wins.Value = currentWins or 0
else
wins.Value = 0
end
local stickers = Instance.new("Folder")
stickers.Name = "OwnedStickers"
stickers.Parent = player
local success3, stickerTable = pcall(function()
return stickersData:GetAsync("Stickers_"..player.UserId)
end)
if success3 then
if stickerTable then
for _, sticker in pairs(stickerTable) do
local stickerClone = stickersFolder:FindFirstChild(sticker)
if stickerClone then
stickerClone:Clone().Parent = stickers
end
end
end
else
warn("Couldn't load stickers")
end
local equippedStickers = Instance.new("Folder")
equippedStickers.Name = "EquippedStickers"
equippedStickers.Parent = player
local canEnterGame = Instance.new("BoolValue")
canEnterGame.Name = "CanEnterGame"
canEnterGame.Value = false
canEnterGame.Parent = player
end)
function save(player)
local success, err = pcall(function()
coinsData:SetAsync("Coins_"..player.UserId, player.leaderstats.Coins.Value)
end)
if success then
print("Saved")
else
warn("Couldn't save", err)
end
local success2, err2 = pcall(function()
winsData:SetAsync("Wins_"..player.UserId, player.leaderstats.Wins.Value)
end)
if success then
print("Saved")
else
warn("Couldn't save", err2)
end
local stickersTable = {}
for _, sticker in pairs(player.leaderstats.OwnedStickers:GetChildren()) do
table.insert(stickersTable, sticker.Name)
end
local success3, err3 = pcall(function()
winsData:SetAsync("Stickers_"..player.UserId, stickersTable)
end)
if success then
print("Saved")
else
warn("Couldn't save", err3)
end
end
game.Players.PlayerRemoving:Connect(function(player)
save(player)
end)
game:BindToClose(function()
for _, player in pairs(game.Players:GetPlayers()) do
save(player)
end
end)
It seems to happen because I deleted a datastore on the dash board so roblox tries to get a “nil” datastore essentially (At least from what i saw in the error.)
It looks like a error in the GetAsync too ho. So i don’t know.
Any help is appreciated