Drawing.new Synchronous

Create a drawing that stays on screen until you update or remove it. Use it for a label, shape, or image whose properties can change over time; it is separate from Roblox Instances and has no Parent.

Syntax
Luau
Drawing.new(kind: DrawingKind) -> DrawingObject

Parameters

Function parameters
ParameterTypeDescription
kindDrawingKindCase-sensitive kind: Line, Text, Image, Circle, Square, Quad, Triangle, Font, or Shader.

Returns

DrawingObject

A DrawingObject with properties for its selected kind.

Usage notes

Most kinds start hidden and need geometry before they can appear. Shader starts visible but needs source, size, and a successful Create call.

Transparency means opacity in Kawaii: 0 is invisible and 1 is fully opaque. Circle.Position is the center; Image and Square positions start at the upper-left corner.

Keep the handle and call Remove when this individual drawing is finished.

Differences from sUNC

Kawaii’s Transparency is opacity: 0 is invisible and 1 is fully opaque. The default is 1. sUNC documents the opposite scale; do not copy its Transparency=0 examples unchanged.

Kawaii adds Font and Shader kinds, an OutlineOpacity property on Text, and rounded corners on Square. Text.Font accepts built-in font numbers, registered DrawFont handles, or Drawing Font objects.

TextBounds is an estimate in Kawaii, based on text length and font size. It is not an exact measurement of the rendered font.

Shared properties

Every kind exposes these properties. Use the kind-specific properties below to supply geometry or content.

PropertyTypeDescription
VisiblebooleanWhether to draw the object. Defaults to false, except for Shader, which defaults to true.
ZIndexnumberDrawing order. Higher values appear above lower values. Defaults to 0.
TransparencynumberOpacity in Kawaii: 0 is invisible, 1 is opaque. Defaults to 1. Rendering clamps the value to 0–1.
ColorColor3Drawing color. Defaults to white.
__OBJECT_EXISTSbooleanRead only. true while the drawing exists; false after Remove, Destroy, or Drawing.clear.

Line

PropertyTypeDescription
FromVector2Starting point in screen pixels. Defaults to Vector2.new(0, 0).
ToVector2Ending point in screen pixels. Defaults to Vector2.new(0, 0).
ThicknessnumberLine width in pixels. Defaults to 1.

Text

Drawing.Font and Drawing.Fonts are aliases of the same constants table: UI=0, System=1, Plex=2, Monospace=3. Font handles from DrawFont.Register and Drawing.new("Font") are also accepted.

PropertyTypeDescription
TextstringText to display. Defaults to an empty string. Newline characters create additional lines.
PositionVector2Upper-left position in screen pixels. Defaults to Vector2.new(0, 0).
SizenumberFont size in pixels. Defaults to 13.
Fontnumber | DrawFont | DrawingObjectBuilt-in font number, registered DrawFont, or DrawingObject of kind Font. Defaults to 0.
CenterbooleanCenter each line horizontally on Position.X. Defaults to false. Centered is an alias.
OutlinebooleanDraw an outline around the text. Defaults to false. Outlined is an alias.
OutlineColorColor3Color of the text outline. Defaults to black.
OutlineOpacitynumberOutline opacity: 0 is invisible, 1 is opaque. Defaults to 1.
TextBoundsVector2Read-only estimate of text width and height, updated after Text, Size, or Font changes. It does not measure actual glyphs or multiline layout.

Image

PropertyTypeDescription
DatastringImage file bytes, for example readfile("icon.png"). Defaults to an empty string. A filename, URL, or Base64 string is not a substitute for the decoded file bytes.
PositionVector2Upper-left position in screen pixels. Defaults to Vector2.new(0, 0).
SizeVector2Width and height in pixels. Defaults to Vector2.new(0, 0).
RoundingnumberCorner radius in pixels. Defaults to 0 for square corners.
LoadedbooleanRead-only image-load status. Defaults to false.

Circle

PropertyTypeDescription
PositionVector2Center of the circle. Defaults to Vector2.new(0, 0).
RadiusnumberRadius in pixels. Defaults to 0, so a new circle has no visible area.
NumSidesnumberDefaults to 64. The renderer uses a polygon below 32 sides and a smooth circle at 32 or more. Rendering clamps the count to 3–4096.
ThicknessnumberOutline width in pixels. Defaults to 1; only used when Filled is false.
FilledbooleanWhether to fill the shape instead of drawing its outline. Defaults to false.

Square

Square is the rectangle kind; its width and height can differ.

PropertyTypeDescription
PositionVector2Upper-left position in screen pixels. Defaults to Vector2.new(0, 0).
SizeVector2Width and height in pixels. Defaults to Vector2.new(0, 0).
RoundingnumberCorner radius in pixels. Defaults to 0.
ThicknessnumberOutline width in pixels. Defaults to 1; only used when Filled is false.
FilledbooleanWhether to fill the shape instead of drawing its outline. Defaults to false.

Triangle

PropertyTypeDescription
PointAVector2First vertex. Defaults to Vector2.new(0, 0).
PointBVector2Second vertex. Defaults to Vector2.new(0, 0).
PointCVector2Third vertex. Defaults to Vector2.new(0, 0).
ThicknessnumberOutline width in pixels. Defaults to 1; only used when Filled is false.
FilledbooleanWhether to fill the shape instead of drawing its outline. Defaults to false.

Quad

Vertices are connected in A, B, C, D order, then back to A.

PropertyTypeDescription
PointAVector2First vertex. Defaults to Vector2.new(0, 0).
PointBVector2Second vertex. Defaults to Vector2.new(0, 0).
PointCVector2Third vertex. Defaults to Vector2.new(0, 0).
PointDVector2Fourth vertex. Defaults to Vector2.new(0, 0).
ThicknessnumberOutline width in pixels. Defaults to 1; only used when Filled is false.
FilledbooleanWhether to fill the shape instead of drawing its outline. Defaults to false.

Font

Font is a Kawaii extension used as a text resource. It does not draw text by itself.

PropertyTypeDescription
DatastringRaw font file bytes. Defaults to an empty string. Assign this Font object to a Text drawing’s Font property.

Shader

Shader is a Kawaii extension. Set both source properties and call shader:Create() to compile them. The compiler does not load filesystem includes or imports. Compilation failures raise an error.

PropertyTypeDescription
VertexstringSelf-contained vertex shader source. Defaults to an empty string; compilation requires 1–1,048,576 bytes.
PixelstringSelf-contained pixel shader source. Defaults to an empty string; compilation requires 1–1,048,576 bytes.
PositionVector2Upper-left position in screen pixels. Defaults to Vector2.new(0, 0).
SizeVector2Width and height in pixels. Defaults to Vector2.new(0, 0).

Example

Example
Luau
local label = Drawing.new("Text")
label.Text = "Saved"
label.Position = Vector2.new(40, 40)
label.Size = 20
label.Color = Color3.fromRGB(255, 255, 255)
label.Transparency = 1 -- opaque in Kawaii
label.Visible = true
task.delay(5, function() label:Remove() end)
Kawaii documentation