cleardrawcache

Stops all drawing objects from rendering.

Syntax

cleardrawcache() -> ()

Returns

This function does not return a value.

Description

cleardrawcache removes all drawing objects. Existing variables may still reference removed objects, but those objects no longer render.

Example

-- Create several drawings
local drawings = {}
for i = 1, 10 do
    local circle = Drawing.new("Circle")
    circle.Position = Vector2.new(100 * i, 100)
    circle.Radius = 50
    circle.Visible = true
    table.insert(drawings, circle)
end

-- Later, clear everything at once
cleardrawcache()
-- All 10 circles are no longer rendered

Use Cases

  • Script cleanup: Remove all drawings when a script ends
  • Reset: Clear all visuals before recreating them
  • Cleanup: Stop every active drawing from rendering

Notes

  • This clears all drawings in the current environment, not only drawings created by the calling script
  • Use with caution in multi-script environments
  • Individual drawings can be removed with :Remove() or :Destroy()