How could i use luau buffers for instance serialization?

Hello, I want to know how i could use the new luau buffers to serialize instances, i couldnt find any good tutorial about luau buffers so im asking here. Any help?

did u find a tutorial for luau buffers for instance serialization?

this is a code sample from here where they serialize position and orientation

separate properties of the instance into numbers (size depends on value i think) and then put them next to each other in the buffer. You have to have the same order so you can decode it later

-- each object takes 3*4 bytes for position and 3*2 bytes for orientation
local buf = buffer.create(#objects * (12 + 6))

for i, obj: Part in objects do
    local offset = (i - 1) * (12 + 6) -- note: buffer offsets are 0-based
    local pos, ori = obj.Position, obj.Orientation

    -- 12 bytes for position, 4 bytes per component
    buffer.writef32(buf, offset + 0, pos.X)
    buffer.writef32(buf, offset + 4, pos.Y)
    buffer.writef32(buf, offset + 8, pos.Z)

    -- 6 bytes for orientation, 2 bytes per component
    -- note: orientation components use degrees with -180..180 range
    -- we're a little sloppy here and use a subset of the full i16 range
    -- when reading this data, make sure to divide i16 by 100
    buffer.writei16(buf, offset + 12, math.round(ori.X * 100))
    buffer.writei16(buf, offset + 14, math.round(ori.Y * 100))
    buffer.writei16(buf, offset + 16, math.round(ori.Z * 100))
end