DrawingImmediate.FilledRectangle Synchronous

Draw a filled rectangle using an upper-left position, dimensions, and corner rounding. Use it for a panel background or filled progress indicator.

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

Parameters

Function parameters
ParameterTypeDescription
positionVector2Upper-left anchor in screen pixels; centered text uses this as its horizontal center.
sizeVector2Dimensions of the rectangle.
colorColor3Color3 used for the primitive or text.
opacitynumberOpacity from 0 (invisible) to 1 (opaque).
roundingnumberCorner rounding of the rectangle.

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.FilledRectangle(Vector2.new(40, 40), Vector2.new(180, 80), color, 0.8, 8)
end)
task.wait(3)
connection:Disconnect() -- stop drawing this example
Kawaii documentation