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.
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 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.
| 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. Compilation failures raise an error.
| Property | Type | Description |
|---|---|---|
Vertex | string | Vertex shader source. Defaults to an empty string. |
Pixel | string | Pixel shader source. Defaults to an empty string. |
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 = "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)