Drawing.create

Creates a retained UI control.

Syntax

Signature
Drawing.create(Kind: string, Properties: table?) -> DrawingControl

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
KindstringRetained control kind.
Propertiestable?Initial properties. Parent must be another live control from this UI context.

Returns

TypeDescription
DrawingControlNew retained control table.

Notes

Kind must be Frame, ScrollingFrame, TextLabel, TextBox, TextButton, Button, Checkbox, Slider, or ImageLabel. Creating the first control starts the library's input and update loop. Each UI context allows up to 512 live controls.

Positions are relative to Parent. BackgroundTransparency and TextTransparency use 0 for opaque and 1 for transparent. Destroy a root control to remove its descendants.

Example

Luau
local Frame = Drawing.create("Frame", {Position = Vector2.new(40, 80), Size = Vector2.new(280, 130), Draggable = true})
local Box = Drawing.create("TextBox", {Parent = Frame, Position = Vector2.new(12, 12), Size = Vector2.new(256, 32), PlaceholderText = "Your message"})
local Button = Drawing.create("TextButton", {Parent = Frame, Position = Vector2.new(12, 58), Text = "Print"})
Button.MouseButton1Click:Connect(function() print(Box.Text) end)