Issue
The portion(when plays get removed) is not saving properly(SetAsync doesn't seem to activate)
What I've tried
Adding if statements incase anything ended up in the 'Identities' folder.
What I know
The PlayerAdded function is perfectly fine and working correctly as intended. There were no errors when I was testing in-game with multiple players.
What I want to know
Why is the second function(PlayerRemoved) not activating SetAsync.
Full script
local keyx="CollectorsEdition" game.Players.PlayerAdded:connect(function(plr) coroutine.wrap(function() repeat wait() until plr~=nil plr:LoadCharacter() local stat=plr local xdatas=game:GetService"DataStoreService":GetDataStore(plr.userId) if xdatas:GetAsync(keyx)==nil then xdatas:SetAsync(keyx,{""..plr.Name..""}) end local CardStore = Instance.new("Folder") CardStore.Parent = plr CardStore.Name = "Identities" local taaa = xdatas:GetAsync(keyx) for i,v in pairs(taaa) do wait() local Plane = Instance.new("ObjectValue") Plane.Parent = CardStore Plane.Name = v end plr:LoadCharacter() end)() end) game.Players.PlayerRemoving:connect(function(plr) coroutine.wrap(function() wait() local datas2=game:GetService"DataStoreService":GetDataStore("ID"..plr.userId.."") local stat=plr local vvxTeemo = {} for i,v in pairs(plr.Identities:GetChildren()) do if v:IsA("ObjectValue") then wait() table.insert(vvxTeemo, 0, ""..v.Name.."") end end datas2:SetAsync(keyx,vvxTeemo) end)() end)