Skip to content

HatusuynZ/Soap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 

Repository files navigation

luau

🧼 Soap

A lightweight cleanup utility for Roblox/Luau. Soap keeps track of objects like Instances, connections, threads, tweens, and functions β€” and destroys them all at once when you're done.

πŸš€ Quick Start

lualocal soap = Soap.New()

local part = Instance.new("Part")
local connection = part.Touched:Connect(function() end)
local thread = task.delay(5, function() end)

soap:Add(part, connection, thread)

-- Later, when you're done:
soap:Cleanup()

πŸ§ͺ Example

local Soap = require(path.to.Soap)

local function setup(part)
    local soap = Soap.New()

    soap:Add(
        part.Touched:Connect(function()
            print("Touched!")
        end),
        task.delay(10, function()
            print("10 seconds passed")
        end)
    )

    return soap
end

πŸ“– Supported Types

Type Action
Instance :Destroy()
RBXScriptConnection :Disconnect()
thread task.cancel()
function called with no arguments
Tween :Cancel()
table (nested) recursively cleaned

πŸ“ Notes

Nested tables are supported: if you add a table, Soap will recursively clean its contents. Cleanup() is safe to call multiple times β€” it won't error on an already-empty instance. Destroy() should be called when the Soap instance itself is no longer needed.

About

an efficient cleaner that prevents memory leaks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages