DrawingImmediate.Line Synchronous

Draw a straight segment between two screen points for the current frame. It is useful for a divider, underline, or connector whose endpoints move.

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

Parameters

Function parameters
ParameterTypeDescription
fromVector2Starting screen position.
toVector2Ending screen position.
colorColor3Color3 of the primitive or text.
opacitynumberOpacity from 0 (invisible) to 1 (opaque).
thicknessnumberStroke width in screen pixels.

Returns

()

No values.

Usage notes

Immediate primitives last for one paint cycle. Submit the call again from a GetPaint listener to keep it visible; there is no object handle to update or remove.

Example

Example
Luau
local paint = DrawingImmediate.GetPaint()
local connection = paint:Connect(function()
    DrawingImmediate.Line(Vector2.new(40, 40), Vector2.new(220, 40), Color3.fromRGB(240, 150, 190), 1, 2)
end)
task.delay(3, function() connection:Disconnect() end)
Kawaii documentation