Shared

The shared section is comprised of methods that both the server and client can do. There is currently only one of these.

Network

The network is essentially a remote wrapper to make code more readable.

createRemoteEvent

This method is only available on the server.

API.network:createRemoteEvent("remoteName",function(player,...)
    print(player,...)
end)

bindRemoteEvent

This method is available on the server and client.

API.network:bindRemoteEvent("remoteName",function(...)
    print(...)
end)

Binding an event on the server will use ".OnServerEvent", and binding an event on the client will use ".OnClientEvent". The "OnClientEvent" is called when ":fireClient" is used, and "OnServerEvent" is called when ":fireServer:" is used.

fireClients

This method is only available on the server.

API.network:fireClients("remoteName",game:GetService("Players"):GetPlayers(),"argument")

This method allows you to fire multiple clients at once. This can also be used with ":fireClient."

fireClient

This method is only available on the server.

API.network:fireClient("remoteName",game:GetService("Players").Player1,"argument")

This method allows you to fire the specified client, you can also send a table of clients (which is what ":fireClients" does.)

fireAllClients

This method is only available on the server.

API.network:fireAllClients("remoteName","argument")

This method allows you to instantly fire all clients in the game with your specified arguments.

fireServer

This method is only available on the client.

API.network:fireServer("remoteName","argument")

This method will fire the specified remote event with the arguments you provide.

createRemoteFunction

This method is only available on the server.

API.network:createRemoteFunction("remoteName",function(player,...)
    return true
end)

This method creates a remote function with the specified name and callback. Values you return will be sent back to the client when they use ":invokeServer."

invokeServer

This method is only available on the client.

API.network:invokeServer("remoteName","argumentToInvoke")

This method will invoke the server for a response that is set with ":createRemoteFunction."

createBindableEvent

This method is available on the server and client.

Bindable events do not replicate, meaning the client cannot fire the server and vice-versa.

API.network:createBindableEvent("bindableName",function(...)
    print(...)
end)

This method will create a bindable event that can be fired with ":fire." Bindable events are essentially remotes but for the client / server to communicate between different scripts.

fire

This method is available on the server and client.

Bindable events do not replicate, meaning the client cannot fire the server and vice-versa.

API.network:fire("bindableName","argument here")

This method will send arguments to the callback you set up with the ":createBindableEvent"

createBindableFunction

This method is available on the server and the client.

Bindable functions do not replicate, meaning the client cannot invoke the server and vice-versa.

API.network:createBindableFunction("bindableName",function(...)
    return true
end)

This method will set up a bindable function and whatever the callback returns can be retrieved by using ":invoke."

invoke

This method is available on the server and the client.

Bindable functions do not replicate, meaning the client cannot invoke the server and vice-versa.

print(API.network:invoke("bindableName","argument"))

This method will invoke the bindable you set up. If you made it return anything, it will print that out.

Last updated