local e=game:GetService("\082\117\110\083\101\114\118\105\099\101")local y=e:IsServer()local h=Instance.new("\082\101\109\111\116\101\069\118\101\110\116")local l=Instance.new("\082\101\109\111\116\101\070\117\110\099\116\105\111\110")local p={script=script,Announce=h;Ban=h,Bans=h;Command=h;Init=h,Log=h,Logs=h;Member=h;Members=h;Notify=h;Prefix=h;Refresh=h;Role=h,Roles=h,SetCore=h;Setting=h,Settings=h;Teleport=h;Unban=h;ShowFPS=l;RequestCommand=l;Vote=l}for e,h in p do if y then local y=Instance.new(h.ClassName,script)y.Name=e p[e]=y else p[e]=script:WaitForChild(e)end end return setmetatable(p,{__index=function(e,h)local l if y then l=Instance.new("\082\101\109\111\116\101\069\118\101\110\116")l.Name=h l.Parent=script e[h]=l return l else l=script:FindFirstChild(h)e[h]=l end return l end})
local RunService = game:GetService("RunService")

local IsServer = RunService:IsServer()

local _REMOTE = Instance.new("RemoteEvent")
local _REMOTECALL = Instance.new("RemoteFunction")

--- @class Remote
local Remote = {
	script = script,
	Announce = _REMOTE,
	Ban = _REMOTE,
	Bans = _REMOTE,
	Command = _REMOTE,
	Init = _REMOTE,
	Log = _REMOTE,
	Logs = _REMOTE,
	Member = _REMOTE,
	Members = _REMOTE,
	Notify = _REMOTE,
	Prefix = _REMOTE,
	Refresh = _REMOTE,
	Role = _REMOTE,
	Roles = _REMOTE,
	SetCore = _REMOTE,
	Setting = _REMOTE,
	Settings = _REMOTE,
	Teleport = _REMOTE,
	Unban = _REMOTE,

	ShowFPS = _REMOTECALL,
	RequestCommand = _REMOTECALL,
	Vote = _REMOTECALL,
}

for name, base in Remote do
	if IsServer then
		local remote = Instance.new(base.ClassName, script)
		remote.Name = name
		Remote[name] = remote
	else
		Remote[name] = script:WaitForChild(name)
	end
end

-- Dynamic remote creation for command enviroments
return setmetatable(Remote, {
	__index = function(self, key)
		local remote
		if IsServer then
			remote = Instance.new("RemoteEvent")
			remote.Name = key
			remote.Parent = script
			self[key] = remote
			return remote
		else
			remote = script:FindFirstChild(key)
			self[key] = remote
		end

		return remote
	end,
})
