local O=script.MockDataStoreService local g=false if game.GameId==0 then g=true elseif(game:GetService("\082\117\110\083\101\114\118\105\099\101")):IsStudio()then local O,Y=pcall(function()((game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")):GetDataStore("\095\095\084\069\083\084")):SetAsync("\095\095\084\069\083\084","\095\095\084\069\083\084\095"..os.time())end)if not O and Y:find("\052\048\051",1,true)then g=true end end return function(Y)if g or Y then warn("\058\058 \065\100\111\110\105\115 \058\058 \085\115\105\110\103 \077\111\099\107\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101 \105\110\115\116\101\097\100 \111\102 \068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")return require(O)else return game:GetService("\068\097\116\097\083\116\111\114\101\083\101\114\118\105\099\101")end end
--[[
	DataStoreService.lua
	This module decides whether to use actual datastores or mock datastores depending on the environment.

	This module is licensed under APLv2, refer to the LICENSE file or:
	buildthomas/MockDataStoreService/blob/master/LICENSE
]]

local MockDataStoreServiceModule = script.MockDataStoreService

local shouldUseMock = false
if game.GameId == 0 then -- Local place file
	shouldUseMock = true
elseif game:GetService("RunService"):IsStudio() then -- Published file in Studio
	local status, message = pcall(function()
		-- This will error if current instance has no Studio API access:
		game:GetService("DataStoreService"):GetDataStore("__TEST"):SetAsync("__TEST", "__TEST_" .. os.time())
	end)
	if not status and message:find("403", 1, true) then -- HACK
		-- Can connect to datastores, but no API access
		shouldUseMock = true
	end
end

return function(forceMockDatastore)
	-- Return the mock or actual service depending on environment:
	if shouldUseMock or forceMockDatastore then
		warn(":: Adonis :: Using MockDataStoreService instead of DataStoreService")
		return require(MockDataStoreServiceModule)
	else
		return game:GetService("DataStoreService")
	end
end
