DrawingImmediate.Rectangle Synchronous

Draw a rectangle border from an upper-left position and dimensions. Use it for a panel edge or selection outline without covering what is inside.

Syntax
Luau
DrawingImmediate.Rectangle(
    position: Vector2,
    size: Vector2,
    color: Color3,
    opacity: number,
    rounding: number,
    thickness: number
) -> ()

Parameters

Function parameters
ParameterTypeDescription
positionVector2Upper-left screen position.
sizeVector2Width and height as Vector2.
colorColor3Color3 of the primitive or text.
opacitynumberOpacity from 0 (invisible) to 1 (opaque).
roundingnumberCorner radius in pixels.
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.Rectangle(Vector2.new(40, 40), Vector2.new(180, 80), Color3.fromRGB(240, 150, 190), 1, 8, 2)
end)
task.delay(3, function() connection:Disconnect() end)
Kawaii documentation