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.

Syntax
Luau
DrawingImmediate.Text(
    position: Vector2,
    font: number | DrawFont | DrawingObject,
    size: number,
    color: Color3,
    opacity: number,
    text: string,
    center: boolean
) -> ()

Parameters

Function parameters
ParameterTypeDescription
positionVector2Upper-left anchor in screen pixels; centered text uses this as its horizontal center.
fontnumber | DrawFont | DrawingObjectFont identifier, registered DrawFont, or DrawingObject Font variant.
sizenumberFont size for this text submission in pixels.
colorColor3Color3 used for the primitive or text.
opacitynumberOpacity from 0 (invisible) to 1 (opaque).
textstringText to render.
centerbooleanWhether 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

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
Kawaii documentation