function PlayerDataStoreManager.new(B,d)local Y=setmetatable(BaseObject.new(),PlayerDataStoreManager)Y._robloxDataStore=B or error("\078\111 \114\111\098\108\111\120\068\097\116\097\083\116\111\114\101")Y._keyGenerator=d or error("\078\111 \107\101\121\071\101\110\101\114\097\116\111\114")Y._maid._savingConns=Maid.new()Y._datastores={}Y._removing={}Y._pendingSaves=PendingPromiseTracker.new()Y._removingCallbacks={}Y._maid:GiveTask(Players.PlayerRemoving:Connect(function(B)if Y._disableSavingInStudio then return end Y:_removePlayerDataStore(B)end))game:BindToClose(function()if Y._disableSavingInStudio then return end;(Y:PromiseAllSaves()):Wait()end)return Y end
--[=[
	Constructs a new PlayerDataStoreManager.
	@param robloxDataStore DataStore
	@param keyGenerator (player) -> string -- Function that takes in a player, and outputs a key
	@return PlayerDataStoreManager
]=]
function PlayerDataStoreManager.new(robloxDataStore, keyGenerator)
	local self = setmetatable(BaseObject.new(), PlayerDataStoreManager)

	self._robloxDataStore = robloxDataStore or error("No robloxDataStore")
	self._keyGenerator = keyGenerator or error("No keyGenerator")

	self._maid._savingConns = Maid.new()

	self._datastores = {} -- [player] = datastore
	self._removing = {} -- [player] = true
	self._pendingSaves = PendingPromiseTracker.new()
	self._removingCallbacks = {} -- [func, ...]

	self._maid:GiveTask(Players.PlayerRemoving:Connect(function(player)
		if self._disableSavingInStudio then
			return
		end

		self:_removePlayerDataStore(player)
	end))

	game:BindToClose(function()
		if self._disableSavingInStudio then
			return
		end

		self:PromiseAllSaves():Wait()
	end)

	return self
end
