DrawingImmediate.Line Synchronous

Draw a line between two screen positions during the current paint cycle. Use thickness to control its width. Use it for a divider, underline, or connector in a changing overlay.

Syntax
Luau
DrawingImmediate.Line(
    from: Vector2,
    to: Vector2,
    color: Color3,
    opacity: number,
    thickness: number
) -> ()

Parameters

Function parameters
ParameterTypeDescription
fromVector2Starting position of the line.
toVector2Ending position of the line.
colorColor3Color3 used for the primitive or text.
opacitynumberOpacity from 0 (invisible) to 1 (opaque).
thicknessnumberStroke thickness for an unfilled primitive.

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.Line(Vector2.new(40, 40), Vector2.new(220, 40), color, 1, 2)
end)
task.wait(3)
connection:Disconnect() -- stop drawing this example
Kawaii documentation