local a=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local w=game:GetService("\083\116\097\114\116\101\114\071\117\105")local B=require(script.Parent.CreateGui)return function(b)local V,u,i local function t(a,w,B)local b=Instance.new(a)b.Name=w b.Parent=B or V return b end V=script.Parent.CmdrClient V.Parent=a u=t("\082\101\109\111\116\101\070\117\110\099\116\105\111\110","\067\109\100\114\070\117\110\099\116\105\111\110")i=t("\082\101\109\111\116\101\069\118\101\110\116","\067\109\100\114\069\118\101\110\116")t("\070\111\108\100\101\114","\067\111\109\109\097\110\100\115")t("\070\111\108\100\101\114","\084\121\112\101\115")script.Parent.Shared.Parent=V b.ReplicatedRoot=V b.RemoteFunction=u b.RemoteEvent=i b:RegisterTypesIn(script.Parent.BuiltInTypes)script.Parent.BuiltInTypes:Destroy()script.Parent.BuiltInCommands.Name="\083\101\114\118\101\114 \099\111\109\109\097\110\100\115"if w:FindFirstChild("\067\109\100\114")==nil then B()end end
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local CreateGui = require(script.Parent.CreateGui)

-- Handles initial preparation of the game server-side.
return function(cmdr)
	local ReplicatedRoot, RemoteFunction, RemoteEvent

	local function Create(class, name, parent)
		local object = Instance.new(class)
		object.Name = name
		object.Parent = parent or ReplicatedRoot

		return object
	end

	ReplicatedRoot = script.Parent.CmdrClient
	ReplicatedRoot.Parent = ReplicatedStorage

	RemoteFunction = Create("RemoteFunction", "CmdrFunction")
	RemoteEvent = Create("RemoteEvent", "CmdrEvent")

	Create("Folder", "Commands")
	Create("Folder", "Types")

	script.Parent.Shared.Parent = ReplicatedRoot

	cmdr.ReplicatedRoot = ReplicatedRoot
	cmdr.RemoteFunction = RemoteFunction
	cmdr.RemoteEvent = RemoteEvent

	cmdr:RegisterTypesIn(script.Parent.BuiltInTypes)

	script.Parent.BuiltInTypes:Destroy()
	script.Parent.BuiltInCommands.Name = "Server commands"

	if StarterGui:FindFirstChild("Cmdr") == nil then
		CreateGui()
	end
end
