Skip to content

DrawingImmediate

The DrawingImmediate Library provides support for instantaneous drawing (unlike Drawing.new which requires manual management of objects, including deletion)

Notes; Erroring within the DrawingImmediate context will cause a stack-less error (Stack Begin, Stack End) Yielding is currently not supported within the DrawingImmediate context

clearimmediatecache

function clearimmediatecache() -> void
Clears every connected drawingimmediate connection

DrawingImmediate.Clear()

function DrawingImmediate.Clear() -> void
alias of clearimmediatecache, Clears every connected drawingimmediate connection

DrawingImmediate.GetPaint()

function DrawingImmediate.GetPaint(ZIndex: number) -> ImmediateSignal
Returns a signal that will draw with the ZIndex specified, if no ZIndex is specified (none), then the default ZIndex will be 1

Draws a white circle with 60 radius where your cursor is

local UserInputService = game.UserInputService
DrawingImmediate.GetPaint():Connect(function(Context)
        Context.Circle(UserInputService:GetMouseLocation(), 60, Color3.new(1, 1, 1), 1, 60, 1)
end)

DrawingImmediate.New()

function DrawingImmediate.New(ZIndex: number) -> ImmediateSignal
alias of GetPaint

Drawing Context Functions

When connecting the signal as shown in the GetPaint example, The first argument will be a draw context (specific to that zindex)

Example to show how you can use drawing immediate contexts

DrawingImmediate.GetPaint():Connect(function(Context)
    --Context.Circle( ... ) etc
end)

Functions are as follows:

Context.Circle()

function Circle(center: Vector2, radius: number, color: Color3, opacity: number, num_sides: int, thickness: number)
Draws a circle within the current DrawingImmediate Context

Context.FilledCircle()

function FilledCircle(center: Vector2, radius: number, color: Color3, num_sides: int, opacity: number)
Draws a filled circle within the current DrawingImmediate Context

Context.Line()

function Line(p1: Vector2, p2: Vector2, color: Color3, opacity: number, thickness: number)
Draws a line within the current DrawingImmediate Context

Context.Triangle()

function Triangle(p1: Vector2, p2: Vector2, p3: Vector3, color: Color3, opacity: number, thickness: number)
Draws a triangle within the current DrawingImmediate Context

Context.FilledTriangle()

function FilledTriangle(p1: Vector2, p2: Vector2, p3: Vector3, color: Color3, opacity: number)
Draws a filled triangle within the current DrawingImmediate Context

Context.Rectangle()

function Rectangle(pos: Vector2, size: Vector2, color: Color3, opacity: number, rounding: number, thickness: number)
Draws a rectangle within the current DrawingImmediate Context

Context.FilledRectangle()

function FilledRectangle(pos: Vector2, size: Vector2, color: Color3, opacity: number, rounding: number)
Draws a filled rectangle within the current DrawingImmediate Context

Context.Quad()

function Quad(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, color: Color3, opacity: number, thickness: number)
Draws a quad within the current DrawingImmediate Context

Context.FilledQuad()

function FilledQuad(p1: Vector2, p2: Vector2, p3: Vector2, p4: Vector2, color: Color3, opacity: number, thickness: number)
Draws a filled quad within the current DrawingImmediate Context

Context.Text()

function Text(position: Vector2, font: DrawFont, font_size: number, color: Color3, opacity: number, text: string, center: bool)
Draws a text within the current DrawingImmediate Context Note: DrawingFont is passed in as something like Drawing.Fonts.Plex etc

Context.OutlinedText()

function OutlinedText(position: Vector2, font: DrawFont, font_size: number, color: Color3, opacity: number, outline_color: Color3, outline_opacity: number, text: string, center: bool)
Draws a text within the current DrawingImmediate Context Note: DrawingFont is passed in as something like Drawing.Fonts.Plex etc