Drawing.new Synchronous

Create a 2D drawing that appears over the game view. Choose a shape, image, or text object, set its properties, and enable Visible to display it. Drawings are separate from Roblox Instances and are removed with Remove or Destroy. Use persistent drawings for labels and shapes that stay visible until their properties change. For shapes recalculated on every frame, DrawingImmediate provides a separate submission API.

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 the properties for its selected kind. It has no Parent and is not part of the DataModel.

Usage notes

Set the object’s size or geometry before making it visible. Most kinds start hidden with zero dimensions; Shader starts visible but still needs source, size, and a successful Create call.

Coordinates and dimensions are in screen pixels. Circle.Position is the center; Image and Square use the upper-left corner. Text.Position is the upper-left anchor unless Center is true.

Keep the handle while using the drawing and call Remove when finished. Use Drawing.clear only when all current drawing objects should be removed.

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. Compilation failures raise an error.

PropertyTypeDescription
VertexstringVertex shader source. Defaults to an empty string.
PixelstringPixel shader source. Defaults to an empty string.
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 = "Hello, Kawaii!"
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