--[[

   _____ _                 _                  _           _       
  / ____(_)               | |        /\      | |         (_)      
 | (___  _ _ __ ___  _ __ | | ___   /  \   __| |_ __ ___  _ _ __  
  \___ \| | '_ ` _ \| '_ \| |/ _ \ / /\ \ / _` | '_ ` _ \| | '_ \ 
  ____) | | | | | | | |_) | |  __// ____ \ (_| | | | | | | | | | |
 |_____/|_|_| |_| |_| .__/|_|\___/_/    \_\__,_|_| |_| |_|_|_| |_|
                    | |                                           
                    |_|                                           

--]]


local Config = {
	DebugMode = false; -- Loads the MainModule (parented to the Loader) rather than the live asset.
	Asset = 5300444087;
	Settings = require(script.Parent.Parent:WaitForChild("Settings"))
}

if not _G.SimpleAdminLoaded then
	script.Parent.Parent.Parent = game:GetService("ServerScriptService")
	
	_G.SimpleAdmin = script.Parent.Parent
	local Start = tick()
	local Module = require((Config.DebugMode) and script:WaitForChild("MainModule") or Config.Asset)
	
	if Module(Config.Settings) then
		_G.SimpleAdminLoaded = true;
		warn("SimpleAdmin Loaded! (" .. tick() - Start .. " seconds)")
	else
		warn("Something went wrong while loading SimpleAdmin.")	
	end
else
	local Model = script.Parent.Parent.Parent.Parent
	if Model:IsA("Model") and Model.Name == "SimpleAdmin" then
		Model:Destroy()
	end
end
