Document:Delete Synchronous

Delete the selected document at its storage location. It also invalidates this handle, so discard the handle after a successful call.

Syntax
Luau
Document:Delete() -> ()

Parameters

Call this method with a Document receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

This function takes no arguments.

Returns

()

No values.

Usage notes

Deletion affects the user-selected file or folder. Only call it for a document the user intends to remove.

Even GetName and IsFile reject a handle after Delete succeeds.

Example

Example
Luau
-- Save a disposable example, then remove that same file.
local document = savefiledialog("Temporary", { suggestedName = "delete-example.txt" })
if document then
    document:Delete()
    document = nil
end
Kawaii documentation