DrawingImmediate. Text Synchronous
Draw text at a screen position for the current paint cycle, using a built-in or custom font. Use it for a label whose contents or position are recomputed each frame.
Luau
DrawingImmediate.Text(
position: Vector2,
font: number | DrawFont | DrawingObject,
size: number,
color: Color3,
opacity: number,
text: string,
center: boolean
) -> ()Parameters
| Parameter | Type | Description |
|---|---|---|
position | Vector2 | Upper-left anchor in screen pixels; centered text uses this as its horizontal center. |
font | number | DrawFont | DrawingObject | Font identifier, registered DrawFont, or DrawingObject Font variant. |
size | number | Font size for this text submission in pixels. |
color | Color3 | Color3 used for the primitive or text. |
opacity | number | Opacity from 0 (invisible) to 1 (opaque). |
text | string | Text to render. |
center | boolean | Whether to center the text. |
Returns
()This function returns no values.
Usage notes
Immediate drawings last for one paint cycle. Call this function again from a GetPaint listener to keep the drawing visible; there is no object handle to update or remove.
Example
Luau
local color = Color3.fromRGB(240, 150, 190)
local paint = DrawingImmediate.GetPaint()
local connection = paint:Connect(function()
DrawingImmediate.Text(Vector2.new(40, 40), Drawing.Fonts.UI, 18, color, 1, "Example label", false)
end)
task.wait(3)
connection:Disconnect() -- stop drawing this example