local g=require(script.Parent.Parent.DataStoreServiceRetriever)local h=require(script.Parent.Parent.Promise)local l={}l.__index=l function l.Get(g)return h.async(function(h)h(g.dataStore:GetAsync(g.userId))end)end function l.Set(l,g)return h.async(function(h)l.dataStore:UpdateAsync(l.userId,function()return g end)h()end)end function l.new(h)return setmetatable({dataStore=(g.Get()):GetDataStore(h.Name);userId=h.UserId},l)end return l
-- Standard saving of data stores
-- The key you provide to DataStore2 is the name of the store with GetDataStore
-- GetAsync/UpdateAsync are then called based on the user ID
local DataStoreServiceRetriever = require(script.Parent.Parent.DataStoreServiceRetriever)
local Promise = require(script.Parent.Parent.Promise)

local Standard = {}
Standard.__index = Standard

function Standard:Get()
	return Promise.async(function(resolve)
		resolve(self.dataStore:GetAsync(self.userId))
	end)
end

function Standard:Set(value)
	return Promise.async(function(resolve)
		self.dataStore:UpdateAsync(self.userId, function()
			return value
		end)

		resolve()
	end)
end

function Standard.new(dataStore2)
	return setmetatable({
		dataStore = DataStoreServiceRetriever.Get():GetDataStore(dataStore2.Name),
		userId = dataStore2.UserId,
	}, Standard)
end

return Standard
