RemoteEvent Handler

作者: jaycex2020 | 来源:发表于2022-02-21 13:07 被阅读0次

    You can use just one RemoteEvent or RemoteFunction to handle many different calls instead of registering a whole new one for every single little message you want to send across the wire. My idiom usually looks something like this:

    server

    local remoteHandler = {}

    function remoteHandler.doOneThing( player, data1 )

     ...

    end

    function remoteHandler.doAnotherThing( player, data1, data2 )

     ...

    end

    workspace.Signals.RemoteHandler.OnServerEvent:Connect( function( player, funcname, … )

     assert( remoteHandler[ funcname ] )

     remoteHandler[funcname]( … )

    end

    client

    workspace.Signals.RemoteHandler:FireServerEvent( "doOneThing", data )

    相关文章

      网友评论

        本文标题:RemoteEvent Handler

        本文链接:https://www.haomeiwen.com/subject/wpxilrtx.html