guide / figma to roblox

Figma to Roblox UI, with the design still intact

A Figma file becomes Roblox UI by compilation, not by a fresh drawing. penui reads the .fig, keeps sizes, 9-slice insets, text layers, and palette, and hands those parts to your agent.

  • design-pixel sizes
  • 9-slice insets
  • editable text layers
  • pack palette

conversion

From a Figma file to parts an agent can place

A designer authors the screen in Figma. penui compiles the .fig into components and pre-split units. Every part carries machine-readable metadata. The MCP server serves those parts. The agent then writes one ScreenGui script.

Studio steps are on Build Roblox UI with AI. The generator comparison is the AI UI builder page. Tool schemas are on the MCP UI tools page.

  1. Compile the fileFrames become components and pre-split units with sizes, insets, text, and palette.
  2. Serve the partsThe agent searches the library and reads a real preview image.
  3. Compose Luaucompose_units or compose_screen emits one scaled ScreenGui script.

two records, one file

Components index the frame. Units split it into layers

The compiler writes two views of the same Figma frame. Agents can search either view. Units are the view they place.

components

A component has a kind: atomic, composite, or screen. It has a category: button, close-button, panel, header, tile, icon, bar, input, decoration, or effect-layer. children and offsetInParent store how the node sat in its parent. Effect layers stay out of search unless you ask for them.

pre-split units

A unit stores full.png, notext.png, and layer files under parts. Links record the parent container, margins, z-order, the nearest sibling, and in-frame repeat positions. get_reconnection and get_hierarchy return that tree, a context image of the original frame, and a compose recipe.

what survives

Sizes, 9-slice, text layers, and the palette

These four records are the conversion. The agent reads them. It does not measure the screen again from a screenshot.

sizes

Sizes stay in design pixels. The record holds frame bounds, offsetInParent, marginsInParent, and zOrderInParent. A repeated card keeps repeatPositions, one entry per slot. compose_units and compose_screen map those pixels into a scaled ScreenGui with UIScale and AutoScale. Repeated slots clone from one template with f:Clone().

9-slice

Insets stay on the part as nineSlice.insetPx. In Roblox that becomes ImageLabel.ScaleType = Slice and a SliceCenter. The center stretches. The corners stay the size the designer drew. A longer label can widen a button without ballooning the radius.

text layers

Copy stays in a texts array, off the bitmap. Each entry has a position, a font, a color, and a stroke. The fonts in the library are Fredoka One and Montserrat. notext.png is the plate with the original words removed. The agent sets a TextLabel. A new label does not need a new render of the Figma file.

palette

get_design_tokens returns the pack colors and those two Roblox fonts. The tools reference lists the top 16 colors per pack. A screen built from one pack keeps one palette. match_theme maps a genre phrase to a base pack. The color values still come from the compiled file.

Images are optional. Buttons, panels, headers, tiles, bars, and inputs also build as Frame, UICorner, UIGradient, UIStroke, and TextLabel. Native mode uses the stored sizes and needs no upload. Asset mode uses the 9-slice PNG when you want the Figma texture.

Library count: 2,576+ components across 15 packs (13 design packs and 2 icon packs). penui-icons includes 800+ CC0 icons. Source .fig licenses stay with their authors.

renderer limits

What the compiler does not keep as drawn

Some Figma effects do not survive the render. Plan the screen around that list.

Approximated

NOISE and GRAIN are approximated. The rest of the part still compiles. Do not expect a grain stack to match the Figma file pixel for pixel.

Not rendered

BACKGROUND_BLUR is not rendered. Angular gradients are not rendered. Diamond gradients are not rendered. Use a pack fill the compiler does keep, or accept a flat stand-in.

Effect layers are indexed and hidden from default search. Ask for the category effect-layer when you need them.

after the compile

What the agent does with the compiled parts

The file is already data. The agent selects, checks, and compiles Luau. It does not redraw the frame.

  1. Search and seesearch_components or search_units finds candidates. get_component returns the image. A contact sheet can show up to 24 units.
  2. Preview for freepreview_units uses the same arguments as compose_units and returns a local PNG plus an HTML critique. Marketing pages list that call as free.
  3. Compose one scriptcompose_screen or compose_units writes one scaled ScreenGui. get_luau writes Luau for a single part.

On the marketing pages, get_luau costs 1 unit. compose_screen and compose_units cost 1 unit per 10 distinct items, minimum 1. Search and preview stay outside that meter.

Studio is the next hop, on the Roblox guide. execute_luau places the ScreenGui in StarterGui. For pixel-exact art, upload_unit_assets stages PNGs, Studio upload_image or Open Cloud upload_assets binds rbxassetid:// URLs, and register_uploaded_assets stores the map. Native instances still build with no upload.

Pairing that server with your current agent is Build UI with your AI. Setup is in the docs. Packs are on pricing and in the library. Agents can start from llms.txt.

questions

Frequently asked questions

What does penui preserve from a Figma file?

penui preserves design-pixel sizes, parent and child offsets, 9-slice insets, text layers, fonts, and the pack palette. nineSlice.insetPx maps to ImageLabel ScaleType Slice. Text lives in a texts array with position, Fredoka One or Montserrat, color, and stroke. A notext PNG holds the artwork without baked copy.

What does the Figma renderer drop or approximate?

NOISE and GRAIN are approximated. BACKGROUND_BLUR is not rendered. Angular and diamond gradients are not rendered. Effect layers stay out of default search.

What does the agent do after the file is compiled?

The agent calls search_components or search_units, then get_component to see the image. preview_units checks a layout for free. compose_screen or compose_units writes one ScreenGui Luau script. Roblox Studio MCP places it with execute_luau. Pixel-exact art is optional through upload_unit_assets.

Where are the Studio steps and the generator comparison?

The Studio install and execute walkthrough is the Roblox UI guide. The generator-versus-library essay is the AI UI builder page. This page is only the conversion: what the compiler keeps, and what the agent does with those parts.