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.
Drawing.new(kind: DrawingKind) -> DrawingObjectParameters
| Parameter | Type | Description |
|---|---|---|
kind | DrawingKind | Case-sensitive kind: Line, Text, Image, Circle, Square, Quad, Triangle, Font, or Shader. |
Returns
DrawingObjectA 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.
| Property | Type | Description |
|---|---|---|
Visible | boolean | Whether to draw the object. Defaults to false, except for Shader, which defaults to true. |
ZIndex | number | Drawing order. Higher values appear above lower values. Defaults to 0. |
Transparency | number | Opacity in Kawaii: 0 is invisible, 1 is opaque. Defaults to 1. Rendering clamps the value to 0–1. |
Color | Color3 | Drawing color. Defaults to white. |
__OBJECT_EXISTS | boolean | Read only. true while the drawing exists; false after Remove, Destroy, or Drawing.clear. |
Line
| Property | Type | Description |
|---|---|---|
From | Vector2 | Starting point in screen pixels. Defaults to Vector2.new(0, 0). |
To | Vector2 | Ending point in screen pixels. Defaults to Vector2.new(0, 0). |
Thickness | number | Line 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.
| Property | Type | Description |
|---|---|---|
Text | string | Text to display. Defaults to an empty string. Newline characters create additional lines. |
Position | Vector2 | Upper-left position in screen pixels. Defaults to Vector2.new(0, 0). |
Size | number | Font size in pixels. Defaults to 13. |
Font | number | DrawFont | DrawingObject | Built-in font number, registered DrawFont, or DrawingObject of kind Font. Defaults to 0. |
Center | boolean | Center each line horizontally on Position.X. Defaults to false. Centered is an alias. |
Outline | boolean | Draw an outline around the text. Defaults to false. Outlined is an alias. |
OutlineColor | Color3 | Color of the text outline. Defaults to black. |
OutlineOpacity | number | Outline opacity: 0 is invisible, 1 is opaque. Defaults to 1. |
TextBounds | Vector2 | Read-only estimate of text width and height, updated after Text, Size, or Font changes. It does not measure actual glyphs or multiline layout. |
Image
| Property | Type | Description |
|---|---|---|
Data | string | Image 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. |
Position | Vector2 | Upper-left position in screen pixels. Defaults to Vector2.new(0, 0). |
Size | Vector2 | Width and height in pixels. Defaults to Vector2.new(0, 0). |
Rounding | number | Corner radius in pixels. Defaults to 0 for square corners. |
Loaded | boolean | Read-only image-load status. Defaults to false. |
Circle
| Property | Type | Description |
|---|---|---|
Position | Vector2 | Center of the circle. Defaults to Vector2.new(0, 0). |
Radius | number | Radius in pixels. Defaults to 0, so a new circle has no visible area. |
NumSides | number | Defaults 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. |
Thickness | number | Outline width in pixels. Defaults to 1; only used when Filled is false. |
Filled | boolean | Whether to fill the shape instead of drawing its outline. Defaults to false. |
Square
Square is the rectangle kind; its width and height can differ.
| Property | Type | Description |
|---|---|---|
Position | Vector2 | Upper-left position in screen pixels. Defaults to Vector2.new(0, 0). |
Size | Vector2 | Width and height in pixels. Defaults to Vector2.new(0, 0). |
Rounding | number | Corner radius in pixels. Defaults to 0. |
Thickness | number | Outline width in pixels. Defaults to 1; only used when Filled is false. |
Filled | boolean | Whether to fill the shape instead of drawing its outline. Defaults to false. |
Triangle
| Property | Type | Description |
|---|---|---|
PointA | Vector2 | First vertex. Defaults to Vector2.new(0, 0). |
PointB | Vector2 | Second vertex. Defaults to Vector2.new(0, 0). |
PointC | Vector2 | Third vertex. Defaults to Vector2.new(0, 0). |
Thickness | number | Outline width in pixels. Defaults to 1; only used when Filled is false. |
Filled | boolean | Whether 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.
| Property | Type | Description |
|---|---|---|
PointA | Vector2 | First vertex. Defaults to Vector2.new(0, 0). |
PointB | Vector2 | Second vertex. Defaults to Vector2.new(0, 0). |
PointC | Vector2 | Third vertex. Defaults to Vector2.new(0, 0). |
PointD | Vector2 | Fourth vertex. Defaults to Vector2.new(0, 0). |
Thickness | number | Outline width in pixels. Defaults to 1; only used when Filled is false. |
Filled | boolean | Whether 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.
| Property | Type | Description |
|---|---|---|
Data | string | Raw 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.
| Property | Type | Description |
|---|---|---|
Vertex | string | Self-contained vertex shader source. Defaults to an empty string; compilation requires 1–1,048,576 bytes. |
Pixel | string | Self-contained pixel shader source. Defaults to an empty string; compilation requires 1–1,048,576 bytes. |
Position | Vector2 | Upper-left position in screen pixels. Defaults to Vector2.new(0, 0). |
Size | Vector2 | Width and height in pixels. Defaults to Vector2.new(0, 0). |
Example
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)