Skip to main content
Flux exports two generic types. Casting your event objects to them gives you argument checking, return-value checking and autocomplete on both ends.
type pack
default:"(...any)"
The arguments carried by the event, which is what you pass to Fire and what your Connect callback receives.
type pack
default:"(...any)"
The values returned by an invocation: what OnInvoke returns on the server and what Invoke yields on the client.
Both default to (...any), which is why untyped Flux code compiles cleanly but gives you no autocomplete.

Typing an event

Because Args... is a type pack, multiple arguments work exactly as you would expect:
Wrap a multi-value pack in parentheses, as in <(Instance, number)>. A single type needs no parentheses, as in <{ Arg: string }>. Without them, <Instance, number> is parsed as Args... = Instance and Out... = number.

Typing an invocation

The second parameter types the return values.
Use () for the empty pack when an event takes no arguments but does return values.

Arguments and returns together

Sharing type definitions

Declaring the pack once in a shared module keeps the two ends from drifting apart. It is the same problem schemas have, solved the same way.

What generics do and do not do

Generics are a compile-time cast, enforced only by Luau’s type checker. They do not validate anything at runtime.A client that has been tampered with can send any payload it likes, and your typed Connect callback will happily receive it. Every server listener still has to validate its inputs, checking types, clamping ranges and verifying ownership, exactly as you would with a raw RemoteEvent.
Generics and schemas are independent and complementary. Generics constrain what your Luau code may pass; schemas constrain what goes on the wire. Neither implies the other, and a mismatch between them is not reported. A Flux.Server<(string)> with a { T.UInt8() } schema type-checks fine and fails at runtime.

Next steps

Server type

The full generic signature of every server method.

Client type

The full generic signature of every client method.