server=nil service=nil return function()server.Remote={Function=nil;Keys={};Send=function(Q,...)return server.Remote.Function:InvokeClient(Q,...)end;Receive=function(Q,M,J,...)if not Q then return end if J~="\067\108\105\101\110\116\082\101\097\100\121"and server.Remote.Keys[Q.UserId]~=M then service.Disconnect(Q,"\065\116\116\101\109\112\116\101\100 \116\111 \099\097\108\108 \114\101\109\111\116\101")return false end local w=server.Remote.Functions[J]if not w or typeof(w)~="\102\117\110\099\116\105\111\110"then return false end return w(Q,...)end,Functions={ClientReady=function(Q)if server.Remote.Keys[Q.UserId]then service.Disconnect(Q,"\065\116\116\101\109\112\116\101\100 \116\111 \099\104\097\110\103\101 \107\101\121")return end server.Remote.Keys[Q.UserId]=service.GenerateRandom(30)service.Events.Fire("\080\108\097\121\101\114\065\100\100\101\100",Q)return server.Remote.Keys[Q.UserId]end;Echo=function(Q,...)return...end,Detected=function(Q,M)server.AE.Action.Detected(Q,M[1],M[2])end}}end
server = nil
service = nil

return function()
    server.Remote = {
        Function = nil;
        Keys = {};

        Send = function(Player, ...)
            return server.Remote.Function:InvokeClient(Player, ...)
        end;

        Receive = function(plr, key, cmd, ...)
            if not plr then return end
            if cmd ~= "ClientReady" and server.Remote.Keys[plr.UserId] ~= key then service.Disconnect(plr, "Attempted to call remote") return false end
            local func = server.Remote.Functions[cmd]
            if not func or typeof(func) ~= 'function' then return false end
            return func(plr, ...)
        end;

        Functions = {

            ClientReady = function(plr)
                if server.Remote.Keys[plr.UserId] then service.Disconnect(plr, "Attempted to change key") return end
                server.Remote.Keys[plr.UserId] = service.GenerateRandom(30)
                service.Events.Fire('PlayerAdded', plr)
                return server.Remote.Keys[plr.UserId]
            end;

            Echo = function(plr, ...)
                return(...)
            end; 

            Detected = function(plr, args)
				server.AE.Action.Detected(plr, args[1], args[2])
			end;

        };
    }
end