local D local J local I=game:GetService("\080\108\097\121\101\114\115")local f=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local z=game:GetService("\082\117\110\083\101\114\118\105\099\101")local T={}local g={}T.Loaded=false local y local Z=(f:WaitForChild("\080\097\099\107\097\103\101")).Modules if not z:IsClient()then D=game:GetService("\083\101\114\118\101\114\083\116\111\114\097\103\101")J=game:GetService("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")y=(D:WaitForChild("\080\097\099\107\097\103\101")).Modules end function T.Init(D)for D,J in pairs(script:GetChildren())do if J:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then for D,J in pairs(require(J))do T[D]=J end end end for D,J in pairs(Z:GetChildren())do if J:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then g[J.Name]=require(J)end end if y~=nil then for D,J in pairs(y:GetChildren())do if J:IsA("\077\111\100\117\108\101\083\099\114\105\112\116")then g[J.Name]=require(J)end end end for D,J in pairs(g)do if J.Init~=nil then J:Init()end end wait()T.Loaded=true end function T.Get(J,D)if g[D]~=nil then return g[D]end end function T.newModule()local D={}setmetatable(D,{__index=T})function D.Init(D) end return D end return T


local ServerStorage;
local ServerScriptService;
local Players = game:GetService("Players")
local Replicated = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")

local FWork = {}
local Modules = {}

FWork.Loaded = false

local SModulesFolder; 
local ModulesFolder = Replicated:WaitForChild("Package").Modules
if not RunService:IsClient() then 
	ServerStorage = game:GetService("ServerStorage")
	ServerScriptService = game:GetService("ServerScriptService")
	SModulesFolder = ServerStorage:WaitForChild("Package").Modules
end 

function FWork:Init() --initializes the module
	for _,module in pairs(script:GetChildren()) do 
		if module:IsA("ModuleScript") then 
			for i,v in pairs(require(module)) do 
				FWork[i] = v
			end
		end
	end
	for _,module in pairs(ModulesFolder:GetChildren()) do 
		if module:IsA("ModuleScript") then 
			Modules[module.Name] = require(module)
		end
	end
	if SModulesFolder ~= nil then 
		for _,module in pairs(SModulesFolder:GetChildren()) do 
			if module:IsA("ModuleScript") then 
				Modules[module.Name] = require(module)
			end
		end
	end
	for i,v in pairs(Modules) do 
		if v.Init ~= nil then 
			v:Init()
		end
	end
	wait()
	FWork.Loaded = true
end

function FWork:Get(Name) --used for getting cached modules
	if Modules[Name] ~= nil then return Modules[Name] end
end

function FWork.newModule() --used for module creation
	local Module = {}

	setmetatable(Module,{
		__index = FWork;
	})

	function Module:Init() end

	return Module
end

return FWork
