function DataStore.Save(R)if not R.valueUpdated then return end if RunService:IsStudio()and not SaveInStudio then if not SaveInStudioObject then end return end if R.backup then return end if R.value~=nil then local j=clone(R.value)if R.beforeSave then local h,q=pcall(R.beforeSave,j,R)if h then j=q else return end end if not Verifier.warnIfInvalid(j)then return end local h,q=R.savingMethod:Set(j)if not h then error("\115\097\118\101 \101\114\114\111\114\033 "..tostring(q))end for h,q in pairs(R.afterSave)do local y,b=pcall(q,j,R)if not y then end end end end
--[[**
	<description>
	Saves the data to the data store. Called when a player leaves.
	</description>
**--]]
function DataStore:Save()
	if not self.valueUpdated then
		return
	end

	if RunService:IsStudio() and not SaveInStudio then
		if not SaveInStudioObject then
		end
		return
	end

	if self.backup then
		return
	end

	if self.value ~= nil then
		local save = clone(self.value)

		if self.beforeSave then
			local success, newSave = pcall(self.beforeSave, save, self)

			if success then
				save = newSave
			else
				return
			end
		end

		if not Verifier.warnIfInvalid(save) then
			return
		end

		local success, problem = self.savingMethod:Set(save)

		if not success then
			-- TODO: Something more robust than this
			error("save error! " .. tostring(problem))
		end

		for _, afterSave in pairs(self.afterSave) do
			local success, err = pcall(afterSave, save, self)

			if not success then
			end
		end
	end
end
