Skip to content

Latest commit

 

History

History
277 lines (208 loc) · 9.17 KB

File metadata and controls

277 lines (208 loc) · 9.17 KB

Attribute Binary Format

This document describes the format for serialized attributes in Roblox.

Version 0

This section describes the first version of the format. Currently, there is only one version. No bytes are reserved for indicating the version.

This version encodes the Instance.AttributesSerialize property. Because no version indicator is included in the format itself, it is assumed that separate versions of the format will be encoded in separate properties.

Definitions

The following types are defined for the purposes of this specification.

Type Description
uint:N An unsigned integer of length N bits.
int:N A signed integer of length N bits.
float:N An IEEE 754 floating-point number of length N bits.
[N]Type An array of constant length N, each entry of type Type.
[Size]Type An array of length determined by the value of field Size, each entry of type Type.

All values are little-endian.

Entrypoint

Attributes are encoded as a Dictionary that maps attribute names to values.

Several limitations may be applied to the Key field of an Entry in this Dictionary:

  • Must not have a length greater than 100 bytes.
  • May only contain alphanumeric bytes and underscores. (^[0-9A-Za-z_]*$)
  • Must not begin with RBX, which is reserved for Roblox.

Value

  • Size: 4+N bytes
Field Offset Size Type Condition
Type 0 1 uint:8
Value 1 4+1*N String Type == 0x02
Value 1 1 Bool Type == 0x03
Value 1 4 Float Type == 0x05
Value 1 8 Double Type == 0x06
Value 1 8 UDim Type == 0x09
Value 1 16 UDim2 Type == 0x0A
Value 1 4 BrickColor Type == 0x0E
Value 1 12 Color3 Type == 0x0F
Value 1 8 Vector2 Type == 0x10
Value 1 12 Vector3 Type == 0x11
Value 1 4+12*N NumberSequence Type == 0x17
Value 1 4+20*N ColorSequence Type == 0x19
Value 1 8 NumberRange Type == 0x1B
Value 1 16 Rect Type == 0x1C

The value of the Type field determines how the value of the Value field is decoded.

String

  • Size: 4+N bytes
  • Numeric type: 0x02 (2)
  • Decoded type: string (string)
Field Offset Size Type
Size 0 4 uint:32
Value 4 N [Size]uint:8

The Value field determines the bytes of the string.

Bool

  • Size: 1 byte
  • Numeric type: 0x03 (3)
  • Decoded type: bool (boolean)
Type
uint:8

A value of of 0 is decoded to false, while any other value is decoded to true.

false is encoded to 0, and true is encoded to 1.

Float

  • Size: 4 bytes
  • Numeric type: 0x05 (5)
  • Decoded type: float (number)
Type
float:32

Double

  • Size: 8 bytes
  • Numeric type: 0x06 (6)
  • Decoded type: double (number)
Type
float:64

Dictionary

  • Size: 4+N bytes
Field Offset Size Type
Size 0 4 uint:32
Value 4 N [Size]Entry

When decoding, entries with a duplicate Key are discarded.

Entry

  • Size: A+B bytes
Field Offset Size Type
Key 0 A String
Value A B Value

UDim

  • Size: 8 bytes
  • Numeric type: 0x09 (9)
  • Decoded type: UDim (userdata)
Field Offset Size Type
Scale 0 4 float:32
Offset 4 4 int:32

UDim2

  • Size: 16 bytes
  • Numeric type: 0x0A (10)
  • Decoded type: UDim2 (userdata)
Field Offset Size Type
X 0 8 UDim
Y 8 16 UDim

BrickColor

  • Size: 4 bytes
  • Numeric type: 0x0E (14)
  • Decoded type: BrickColor (userdata)
Type
uint:32

The value corresponds to the Number field of the BrickColor value. Unknown values are interpreted as the default BrickColor.

Color3

  • Size: 12 bytes
  • Numeric type: 0x0F (15)
  • Decoded type: Color3 (userdata)
Field Offset Size Type
R 0 4 float:32
G 4 4 float:32
B 8 4 float:32

Vector2

  • Size: 8 bytes
  • Numeric type: 0x10 (16)
  • Decoded type: Vector2 (userdata)
Field Offset Size Type
X 0 4 float:32
Y 4 4 float:32

Vector3

  • Size: 12 bytes
  • Numeric type: 0x11 (17)
  • Decoded type: Vector3 (userdata)
Field Offset Size Type
X 0 4 float:32
Y 4 4 float:32
Z 8 4 float:32

NumberSequence

  • Size: 4+12*N bytes
  • Numeric type: 0x17 (23)
  • Decoded type: NumberSequence (userdata)
Field Offset Size Type
Size 0 4 uint:32
Values 4 12*N [Size]NumberSequenceKeypoint

NumberSequenceKeypoint

Field Offset Size Type
Envelope 0 4 float:32
Time 4 4 float:32
Value 8 4 float:32

ColorSequence

  • Size: 4+20*N bytes
  • Numeric type: 0x19 (25)
  • Decoded type: ColorSequence (userdata)
Field Offset Size Type
Size 0 4 uint:32
Values 4 20*N [Size]ColorSequenceKeypoint

ColorSequenceKeypoint

  • Size: 20 bytes
Field Offset Size Type
Envelope 0 4 float:32
Time 4 4 float:32
Value 8 12 Color3

NumberRange

  • Size: 8 bytes
  • Numeric type: 0x1B (27)
  • Decoded type: NumberRange (userdata)
Field Offset Size Type
Min 0 4 float:32
Max 4 4 float:32

Rect

  • Size: 16 bytes
  • Numeric type: 0x1C (28)
  • Decoded type: Rect (userdata)
Field Offset Size Type
Min 0 8 Vector2
Max 8 8 Vector2