Skip to main content

Bool

Type<boolean>
One byte: 1 for true, 0 for false.
A full byte per boolean, because there is no bit-packing. Eight flags cost eight bytes. If you send many booleans together, pack them into a T.UInt8() bitfield yourself:
Read returns value == 1, so any byte other than 1 decodes as false.

String

Type<string>
A varint length prefix followed by the raw bytes.
number
Optional maximum byte length, asserted on write.

Size

The varint prefix is one byte up to 127, two up to 16,383, and three up to 2,097,151.
Strings are written with buffer.writestring, so they are byte sequences rather than character sequences. Binary data is safe, and maxLen counts bytes, not characters. A UTF-8 emoji costs four against the limit.

The maxLen bound

maxLen is enforced on write only, and it raises a Luau error rather than dropping the message:
Two consequences follow.First, it throws in your code at the Fire call site, not inside Flux. A server Fire with an over-long string errors inside your listener.Second, it is not inbound validation. Read ignores maxLen entirely, so a tampered client can send a string of any length and your server listener receives it in full.Always re-check length inside server listeners handling client data:

Any

Type<any>
Falls back to the dynamic WriteAny and ReadAny encoder for this one entry.
Use it when a single argument’s shape genuinely varies but the rest of the payload is fixed.
T.Any() costs a type tag byte plus the value, which is exactly what an unschematised argument costs. It is the escape hatch rather than an optimisation: an event that is all T.Any() entries is byte-for-byte identical to one with no schema, just more verbose.
It is also the only schema option for datatypes Types has no constructor for:
For those, a custom type usually beats T.Any(). A UDim2 through T.Any() costs 17 bytes; decomposed into two Float32 scales and two Int16 offsets it costs 12, with no tag.
T.Any() inherits every dynamic-encoder limitation. Circular tables overflow the stack, unsupported datatypes become nil with only a sender-side warning, and non-integer numbers cost a full 8 bytes. See Serialization.

Next steps

Roblox datatypes

Vectors, CFrames, instances and enums.

Composites

Nesting types into arrays and structs.