Keeping objects alive
Manage drawings, event handlers, sockets, and world changes.
Some Acedia calls return data you can use once; others create something that continues to exist after the call. A signal connection keeps receiving events, a drawing stays in the renderer, and a WebSocket stays open. Keep their handles where you can reach them later.
Remove retained drawings
For a retained drawing, call Remove when it is no longer needed:
local label = Drawing.new("Text")
label.Text = "Example"
label.Visible = true
-- Later, when the script is finished with it:
label:Remove()cleardrawcache clears all retained drawings, including objects created by other scripts and picker UI. Prefer removing the objects you own. Immediate drawings have no retained object; instead, disconnect the GetPaint connection that redraws them every frame.
Disconnect signals and sockets
Signal.new():Connect()returns a handle withDisconnect.- Engine
RBXScriptSignalconnections can be inspected with getconnections. The returned records are snapshots; keeping one does not revive a stale connection. - A WebSocket has
OnMessageandOnClosesignals and aClosemethod. Close it when finished.
Socket waits: A closed socket may wake an
OnMessagewait withtruerather than a message string.
After a teleport
A teleport replaces the world your script was using. Recreate cached Instances, VM state, drawing handles, and connections. queue_on_teleport queues source text for the destination; it does not transfer live handles.
Hooks do not survive the world they were made in.
