Document:IsFile Synchronous

Check whether a Document points to a file before reading its contents. This matters when you obtained handles by listing a folder.

Syntax
Luau
Document:IsFile() -> boolean

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

boolean

true for a file; false for a folder.

Usage notes

A Document is a handle to the user-selected location, not a workspace path. Call methods with a colon and keep the handle for later operations.

Example

Example
Luau
local folder = openfolderdialog()
if folder then
    for _, child in ipairs(folder:List()) do
        if child:IsFile() then print("File:", child:GetName()) end
    end
end
Kawaii documentation