Skip to content

Event

Blazingly fast & typesafe networking, utilizing Red under the hood.

lua
local ValidateRole = Riptide.Guard.Or(Riptide.Guard.Literal("Murderer"), Riptide.Guard.Literal("Innocent"))
local AssignRole = Riptide.Event.Server("AssignRole", true, function(Role)
    return ValidateRole(Role) -- Automatically types `Team` as `"Murderer" | "Innocent"`
end)

AssignRole:Fire(Murderer, "Murderer")
lua
local ValidateRole = Riptide.Guard.Or(Riptide.Guard.Literal("Murderer"), Riptide.Guard.Literal("Innocent"))
local AssignRole = Riptide.Event.Client("AssignRole", true, function(Role)
    return ValidateRole(Role) -- Automatically types `Team` as `"Murderer" | "Innocent"`
end)

AssignRole:On(function(Role) -- `Role` is now `"Murder" | "Innocent"`
    LocalPlayer.Role.Value = Role
end)

Functions

Client

lua
Event.Client<T...>(
    Name: string,
    Reliable: boolean,
    Validate: (...unknown) → T... -- Purely for typechecking, doesn't actually do anything
) → ClientEvent

Constructs a client event.

Server

lua
Event.Server<T...>(
    Name: string,
    Reliable: boolean,
    Validate: (...unknown) → T... -- Sanity checks the data sent from the player & provides typechecking
) → ServerEvent

Constructs a server event.