local k=game:GetService("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")local t=k:GetChildren()print("\071\101\110\101\114\097\116\105\110\103 \068\111\109\097\105\110\070\105\110\100\101\114 \109\111\100\117\108\101")local Z={}for k,t in pairs(t)do local F=t:FindFirstChild("\095\114\101\103\105\115\116\101\114\077\111\100\117\108\101\115",false)if F~=nil then print(F)local k=require(F)for k,t in pairs(k)do if Z[k]==nil then Z[k]=t end end end end local F={}F.RegisteredServices=Z function F.FindDomain(t,k)if t.RegisteredServices~=nil then local Z=t.RegisteredServices[k]if Z~=nil then return Z end Z=t.RegisteredServices[string.lower(k)]if Z~=nil then return Z end for t,Z in pairs(t.RegisteredServices)do if string.lower(t)==string.lower(k)then return Z end end error("\068\111\109\097\105\110 "..(k.." \110\111\116 \102\111\117\110\100"))return nil end end return F
--[[
    Usage example: 
    	local DomainFinder = require(game
	:GetService("ServerScriptService")
	:WaitForChild("Finders")
	:WaitForChild("DomainFinder"))
    local pointsSvc = svcFinder:FindService("points")
]]

local ServerScriptService = game:GetService("ServerScriptService")

local allChildFolders = ServerScriptService:GetChildren()
print("Generating DomainFinder module")
local dedupedModules = {}


for _, folder in pairs(allChildFolders) do
    local registrationModuleScript = folder:FindFirstChild("_registerModules", false)
    if registrationModuleScript ~= nil then
        print(registrationModuleScript)
        local registrationModule = require(registrationModuleScript)
        for key,mod in pairs(registrationModule) do
            if dedupedModules[key] == nil then
                dedupedModules[key] = mod
            end
        end
    end
end

local module = {}
module["RegisteredServices"] = dedupedModules

function module:FindDomain(serviceName)
    if self.RegisteredServices ~= nil then
        -- First try
        local foundService = self.RegisteredServices[serviceName]
        if foundService ~= nil then
            return foundService
        end

        -- Take another shot
        foundService = self.RegisteredServices[string.lower(serviceName)]
        if foundService ~= nil then
            return foundService
        end

        -- Last try
        for svcKey, svcValue in pairs(self.RegisteredServices) do
            if string.lower(svcKey) == string.lower(serviceName) then
                return svcValue
            end
        end

        error("Domain " .. serviceName .. " not found")
        return nil
    end
end
return module