Skip to content

draw

Immediate-mode 2D/3D drawing primitives for building ESP and overlay visuals on the external layer-shell surface.

draw.Line(x1: number, y1: number, x2: number, y2: number, color: Color3, thickness: number?, alpha: number?)

Draws a line segment between two screen points, thickness defaults to 1 and alpha (0-255) defaults to 255.

draw.Line(0, 0, 100, 100, Color3.new(1, 0, 0), 2, 255)

draw.Rect(x: number, y: number, w: number, h: number, color: Color3, thickness: number?, alpha: number?)

Draws an unfilled rectangle outline, thickness defaults to 1 and alpha (0-255) defaults to 255.

draw.Rect(50, 50, 100, 40, Color3.new(0, 1, 0))

draw.RectFilled(x: number, y: number, w: number, h: number, color: Color3, rounding: number?, alpha: number?)

Draws a filled rectangle, rounding defaults to 0 (sharp corners) and alpha (0-255) defaults to 255.

draw.RectFilled(50, 50, 100, 40, Color3.new(0, 0, 1), 4)

draw.Circle(x: number, y: number, radius: number, color: Color3, thickness: number?, alpha: number?)

Draws an unfilled circle outline, thickness defaults to 1 and alpha (0-255) defaults to 255.

draw.Circle(200, 200, 20, Color3.new(1, 1, 0))

draw.CircleFilled(x: number, y: number, radius: number, color: Color3, alpha: number?)

Draws a filled circle, alpha (0-255) defaults to 255.

draw.CircleFilled(200, 200, 20, Color3.new(1, 1, 0), 180)

draw.Triangle(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color: Color3, thickness: number?, alpha: number?)

Draws an unfilled triangle outline from three screen points, thickness defaults to 1 and alpha defaults to 255.

draw.Triangle(0,0, 50,0, 25,50, Color3.new(1,1,1))

draw.TriangleFilled(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, color: Color3, alpha: number?)

Draws a filled triangle from three screen points, alpha (0-255) defaults to 255.

draw.TriangleFilled(0,0, 50,0, 25,50, Color3.new(1,1,1), 200)

draw.Polyline(points: {Vector2}, color: Color3, thickness: number?, alpha: number?)

Draws connected line segments through an array of at least two Vector2 points, thickness defaults to 1 and alpha defaults to 255.

draw.Polyline({Vector2.new(0,0), Vector2.new(10,10), Vector2.new(20,0)}, Color3.new(1,0,0))

draw.ConvexPolyFilled(points: {Vector2}, color: Color3, alpha: number?)

Draws a filled convex polygon from an array of at least three Vector2 points, alpha (0-255) defaults to 255.

draw.ConvexPolyFilled({Vector2.new(0,0), Vector2.new(10,0), Vector2.new(5,10)}, Color3.new(0,1,0))

draw.Gradient(x: number, y: number, w: number, h: number, colorTop: Color3, colorBottom: Color3, alphaTop: number?, alphaBottom: number?)

Draws a filled rectangle with a vertical gradient between two colors, both alphas (0-255) default to 255.

draw.Gradient(0, 0, 200, 40, Color3.new(1,0,0), Color3.new(0,0,1))

draw.Text(text: string, x: number, y: number, color: Color3, size: number?, alpha: number?, font: string?): nil

Draws text at a screen position, size defaults to 14px, alpha defaults to 255, and font is a bundled or workspace font path (defaults to the built-in font).

draw.Text("Hello", 10, 10, Color3.new(1,1,1), 16)

draw.TextOutlined(text: string, x: number, y: number, color: Color3, size: number?, alpha: number?, font: string?)

Draws text with a dark outline for legibility over any background, same parameters and defaults as draw.Text.

draw.TextOutlined("HP: 100", 10, 30, Color3.new(0,1,0))

draw.LoadFont(path: string): boolean

Explicitly preloads and bakes a font atlas from a bundled name or confined workspace path, returns whether the load succeeded.

local ok = draw.LoadFont("Inter-Bold.ttf")

draw.GetTextSize(text: string, size: number?, font: string?): Vector2

Measures the rendered width and height of a text string at a given font size, size defaults to 14px.

local dims = draw.GetTextSize("Hello", 16)

draw.Image(path: string, x: number, y: number, w: number, h: number, alpha: number?): nil

Draws an image loaded from a confined path at the given screen rect, alpha is 0-1 and defaults to 1.0.

draw.Image("icon.png", 10, 10, 32, 32, 0.8)

draw.GetMesh(...): nil, string

Deprecated, always returns nil plus an error string directing callers to mesh.OfPart or draw.MeshChams.

local ok, err = draw.GetMesh(part)

draw.MeshChams(part: Instance, color: Color3, thickness: number?, alpha: number?, style: string?)

Draws a cached silhouette or wireframe overlay on a MeshPart, part must be a MeshPart, style is “outline” (default), “filled”, or “wireframe”, alpha (0-255) defaults to 180.

draw.MeshChams(part, Color3.new(1,0,0), 1.5, 200, "outline")

draw.MeshChamsBulk(parts: {Instance}, color: Color3, thickness: number?, alpha: number?, style: string?)

Batched form of draw.MeshChams for many MeshParts in one call, caller must pre-filter the array to MeshParts, same style options and defaults as draw.MeshChams.

draw.MeshChamsBulk(meshParts, Color3.new(0,1,1), 1.0, 180, "filled")

draw.Wireframe(mesh: MeshHandle, options: {color: Color3?, alpha: number?, colors: {Color3}?}?)

Draws every triangle edge of a mesh handle obtained from mesh.OfPart, options.color defaults to a green tint and options.colors supplies optional per-vertex colors.

local m = mesh.OfPart(part)
draw.Wireframe(m, {color = Color3.new(0,1,0), alpha = 255})

draw.GetScreenSize(): Vector2

Returns the current Sober window viewport size in screen coordinates used by all draw.* calls.

local size = draw.GetScreenSize()

draw.GetPartCorners(part: Instance): {Vector2}

Projects all 8 world-space corners of a BasePart to screen coordinates, returns an empty table if the part cannot be read (corners behind the camera are still included).

local corners = draw.GetPartCorners(workspace.Part)

draw.ComputeConvexHull(points: {Vector2}): {Vector2}

Computes the 2D convex hull of an array of Vector2 points using Andrew’s monotone chain algorithm.

local hull = draw.ComputeConvexHull(corners)