Skip to content

Cleanup special key since v0.2

Cleans up all items given to it when the instance is destroyed, equivalent to passing the items to Fusion.cleanup.


Example Usage

local example1 = New "Folder" {
    [Cleanup] = function()
        print("I'm in danger!")
    end
}

local example2 = New "Folder" {
    [Cleanup] = example1
}

local example3 = New "Folder" {
    [Cleanup] = {
        RunService.RenderStepped:Connect(print),
        function()
            print("I'm in danger also!")
        end,
        example2
    }
}

example3:Destroy()

Technical Details

This special key runs at the observer stage.

Back to top