Skip to main content
Eight constructors covering the widths buffer supports directly. Each writes exactly its declared size, with no tag byte and no narrowing.

Unsigned integers

Type<number>
One byte. Range 0 to 255.
Type<number>
Two bytes. Range 0 to 65,535.
Type<number>
Four bytes. Range 0 to 4,294,967,295.

Signed integers

Type<number>
One byte. Range -128 to 127.
Type<number>
Two bytes. Range -32,768 to 32,767.
Type<number>
Four bytes. Range -2,147,483,648 to 2,147,483,647.
T.Int8() is the only width the dynamic encoder never selects on its own, because small negative numbers fall through to i16 there. Declaring it in a schema is the only way to get one-byte signed values.

Floats

Type<number>
Four bytes. Roughly 7 significant decimal digits.
Type<number>
Eight bytes. Full Luau number precision, lossless.
This is where schemas actually pay off. The dynamic encoder writes every non-integer as an 8-byte f64, because it cannot know whether you need the precision. Declaring T.Float32() halves it, and for positions, rotations, velocities and normalised values the loss is irrelevant.A Vector3 of world coordinates sent 60 times a second costs 24 bytes per send dynamically and 12 under T.Vector3(), which is f32-based.

Overflow and truncation

These constructors pass straight through to buffer.write*, which does not validate. Out-of-range values are silently truncated to the low bits of the declared width, with no error and no warning.
Clamp before sending anything whose range you do not control:
Passing a non-integer to an integer type also truncates rather than erroring, so T.UInt8() with 3.7 transmits 3. Passing nil errors inside buffer.write* with an unhelpful message, so wrap nullable numbers in T.Optional.

Choosing a width

A UInt32 maxes out at about 4.29 billion, which is enough for os.time() until 2106 but not for millisecond timestamps or Roblox user ids in the far future. Use T.Float64() when you need range beyond 2^32.

Next steps

Primitives

Bool, String and Any.

Roblox datatypes

Vectors, CFrames, instances and enums.