--!no-shared
--!no-service


local ReplicatedStorage = game:GetService('ReplicatedStorage')
local RunService = game:GetService('RunService')

local IsStudio = RunService:IsStudio()

local Modules = ReplicatedStorage
	:WaitForChild('Modules', 30)
	:WaitForChild('Global', 30);
local ModuleWaitTime = IsStudio and 3 or 60

local meta = {}

function meta.__index(self, key)
	return function ()
		local Module = Modules:WaitForChild(key, ModuleWaitTime)

		if Module then
			local Source = require(Module)

			self[key] = function ()
				return Source
			end

			return Source
		end
	end
end

shared._Cache = {};
setmetatable(shared, meta);

return nil
