Drawing

Drawing.new

Creates a new drawing object of the requested type.

Syntax

Drawing.new(objectType: "Image" | "Line" | "Text" | "Circle" | "Square" | "Quad" | "Triangle"): DrawingObject

Arguments

NameTypeDescription
objectType"Image" | "Line" | "Text" | "Circle" | "Square" | "Quad" | "Triangle"Drawing object type to create.

Returns

NameTypeDescription
objectDrawingObjectCreated drawing object.

Description

Creates a new drawing object of the requested type.

Call it with 1 parameter(s): objectType. The argument table explains which values are required and which ones only refine the behavior.

It returns object (DrawingObject). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Create a visible square and configure its basic drawing properties.

local square = Drawing.new("Square")
square.Position = Vector2.new(120, 120)
square.Size = Vector2.new(220, 120)
square.Color = Color3.fromRGB(120, 170, 255)
square.Filled = true
square.Visible = true