Networking
Riptide gives your code named messages over a shared RemoteEvent and request/response calls over a shared RemoteFunction. Use the API exposed as Riptide.Network on the side that sends or receives the message.
Events
Section titled “Events”Register a server listener:
local ReplicatedStorage = game:GetService("ReplicatedStorage")local Riptide = require(ReplicatedStorage.Packages.Riptide)
local function onPing(player, message) print(player.Name, message)end
Riptide.Network.Register("Ping", onPing)Send the event from a client script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")local Riptide = require(ReplicatedStorage.Packages.Riptide)
Riptide.Network.FireServer("Ping", "Hello from the client")The server callback receives the sending player before the supplied arguments. Validate client data before using it in gameplay. Remove a listener with Network.Unregister(name, callback) when it is no longer needed.
Available calls
Section titled “Available calls”| Client | Server |
|---|---|
Register(name, callback) and Unregister(name, callback) |
Register(name, callback) and Unregister(name, callback) |
FireServer(name, ...) |
FireClient(player, name, ...) and FireAllClients(name, ...) |
InvokeServer(name, ...) |
InvokeClient(player, name, ...) |
Fire* sends an event. Invoke* waits for a response from the other side; register a handler for that name first. Prefer events when no response is needed. Network methods use dot calls as shown above.
Next: Connect this to a service.
This page describes Riptide 0.3.0. Check the original release guide and tagged source for release-specific details.