--[=[
	Whenever the ValueObject changes, stores the resulting value in that entry.
	@param name string
	@param valueObj Instance -- ValueBase object to store on
	@return MaidTask
]=]

function DataStoreStage:StoreOnValueChange(name, valueObj)
	assert(type(name) == "string", "Bad name")
	assert(typeof(valueObj) == "Instance", "Bad valueObj")

	if self._takenKeys[name] then
		error(("[DataStoreStage] - Already have a writer for %q"):format(name))
	end

	self._takenKeys[name] = true
	local conn = valueObj.Changed:Connect(function()
		self:_doStore(name, valueObj.Value)
	end)
	self._maid:GiveTask(conn)
	return conn
end
