When a player leaves the game its giving the error 08DCC0B2EC1CCFDF.0000000006.08DCC0B42FA1196C.01
and I have no idea what it means or how to fix it and cant find any topic similar to the issue im facing
function saveCards(plr)
local cardslist = {}
for i,v in pairs(plr.Cards:GetChildren()) do
table.insert(cardslist,{v.Name,v.Amount.Value})
end
for i,v in pairs(workspace:FindFirstChild(plr.Name.."Board").Cards:GetChildren()) do
local equalvvname = nil
for ii,vv in pairs(cardslist) do
print(vv[1],v.Name)
if vv[1] == v.Name then
equalvvname = vv
end
end
if equalvvname then
equalvvname[2]+=1
else
table.insert(cardslist,{v.Name,v.Amount.Value})
end
end
print(cardslist)
local Success, Error = pcall(function()
return dss:GetDataStore("plr_cards_datastore"):SetAsync(plr.UserId.."Cards", cardslist)
end)
if Error then
warn(Error)
end
end
game.Players.PlayerRemoving:Connect(function(plr)
saveCards(plr)
end)
game:BindToClose(function()
if game:GetService("RunService"):IsStudio() then return end
for index, plr in pairs(game.Players:GetPlayers()) do
saveCards(plr)
end
end)