Native Roblox Frame + UICorner vs uploaded UI art: when your AI should use each
Comparing zero-upload native Luau UI (Frame, UICorner, UIGradient, UIStroke) with pixel-exact rbxassetid ImageLabels when creating Roblox UI with AI.
When creating Roblox UI with an AI agent, every screen forces an architectural decision: should the compiled ScreenGui render as pure Roblox GUI instances (Frame, UICorner, UIGradient, UIStroke), or as ImageLabel bitmaps uploaded to Roblox (rbxassetid://)?
You do not have to commit to one approach for an entire project. penui supports both rendering modes from the same Figma metadata—and lets an agent prototype natively first, then promote hero panels to pixel-exact artwork with zero layout rewrites.
How native Luau synthesis works (mode: "native")
For structural categories—button, close-button, panel, header, tile, bar, and input (excluding full-screen composites)—penui can compile a zero-image approximation directly from the component's Figma design tokens:
- Color & gradient:
nativeColors()inspects the Figmapalette, skips near-black and near-white extremes, selects the two dominant chromatic tones asmainandaccent, and builds a 90-degreeUIGradientColorSequence. - Geometry:
cornerRadiusmaps toUICorner, clamped to half the shorter edge so pills stay pills, andstrokeWeightmaps to a border-modeUIStroke(capped at 6px) in a darkened shade of the main color. - Typography & scaling: All
texts[]layers still emit realTextLabels withFredoka OneorMontserratviaFont.fromName, wrapped inside the sameAutoScaleUIScalecanvas.
In mode: "auto", if no rbxassetid:// is registered yet for a compatible category, penui falls back to native automatically so your script runs immediately in Roblox Studio without waiting on asset moderation or upload credentials.
How pixel-exact bitmap mode works (mode: "asset")
When you want the designer's actual bevels, glossy specular highlights, stud patterns, ornate ribbons, or outer neon glows, mode: "asset" emits ImageLabels pointing to uploaded rbxassetid:// textures:
- Studio-bridged upload (no API key): Call
upload_unit_assets(orupload_assets) with your pack or chosen unit IDs. penui serves the PNGs (full,notext, andparts) on a local127.0.0.1stage URL. Roblox Studio MCP'supload_imageimports them under your Studio account, andregister_uploaded_assetssaves the resulting IDs tolibrary/roblox-ids.json. SHA-1 hashes in.uploaded-hashes.jsonensure unchanged files are never uploaded twice. - Open Cloud upload (automated): Set
ROBLOX_API_KEY(and creator ID) in your environment soupload_assets/upload_unit_assetsuploads directly via Roblox Open Cloud without Studio prompts. - Automatic >1024px tiling: Roblox downsamples images wider or taller than 1024 pixels. For oversized frames, penui splits the artwork into sub-tiles and emits an
ASSET_TILESLuau table positioned withUDim2.fromScaleinside a containerFrameso crispness holds.
Performance, memory, and visual trade-offs
- Texture memory on mobile: Native
Frame+UICorner+UIStrokeinstances use virtually no image texture memory and remain vector-sharp on everything from low-end Android phones to 4K monitors. Large bitmap panels consume texture memory proportional to pixel dimensions, especially at@2x. - Join-time pop-in: Native UI renders on frame 1 because there are no remote image fetches. Uploaded
ImageLabels depend on Roblox CDN caching unless preloaded withContentProvider:PreloadAsync. - Visual fidelity: Native Luau cannot reproduce multi-stop inner shadows, diagonal gloss streaks, stud bump textures, or complex corner ornaments. Those require uploaded PNGs (using
notext.png+ 9-sliceSliceCenter+ editableTextLabels). - Moderation delay: Uploaded images pass through Roblox asset moderation before appearing for other players, whereas native instances require zero asset uploads.
The recommended hybrid workflow
Combine both modes inside the same screen:
- Draft and validate natively: Run
decide_screen→preview_units→compose_unitswith native components while dialing in hierarchy, button copy, safe-area padding, and mobileUIScalecaps. - Keep simple geometry native: Progress bars, flat dark modal backdrops, input boxes, and solid-color containers often look cleaner and lighter as native
Frame+UIStrokeinstances even in production. - Promote hero art to bitmaps: Upload only your ornate headers, primary CTA buttons, currency badges, and CC0 icons via
upload_unit_assets+ Studioupload_image+register_uploaded_assets. Once their IDs are recorded inlibrary/roblox-ids.json, re-runningcompose_unitsautomatically switches those pieces tomode: "asset"while keeping the exact same coordinates andTextLabelbindings.
Frequently asked questions
Which penui component categories can build natively without uploading images?
Seven categories support native Frame + UICorner + UIGradient + UIStroke synthesis: button, close-button, panel, header, tile, bar, and input (excluding full-screen composites). Icons and ornate multi-layer art require uploaded PNGs.
How do I switch a native ScreenGui to pixel-exact Figma art later?
Stage and upload the unit PNGs with upload_unit_assets, Studio upload_image, and register_uploaded_assets (or Open Cloud with ROBLOX_API_KEY). Once the rbxassetids are stored in library/roblox-ids.json, re-run compose_units or compose_screen in auto or asset mode.
What happens if a Figma panel is larger than Roblox's 1024px image limit?
penui automatically splits images exceeding 1024px into sub-tiles and generates an ASSET_TILES Luau table using UDim2.fromScale fractions inside a container Frame so Roblox does not blur or downsample the artwork.
Is native mode better for mobile Roblox performance?
Native instances use negligible texture memory, never pop in over the network, and scale sharply at any resolution. A common production pattern is keeping simple bars, backdrops, and inputs native while uploading bitmap art for hero headers, buttons, and CC0 icons.