Filesystem

Read, write, and manage files and folders relative to World's workspace, including Luau loaders and asset URL helpers.

Overview

Every path here is relative to the workspace folder and can't go outside it. The Workspace & Auto-Execute chapter explains the folders, this one is just the functions.

The four you'll use most
if not isfolder("config") then
    makefolder("config")
end

writefile("config/settings.json", game:GetService("HttpService"):JSONEncode({ enabled = true }))
print(readfile("config/settings.json"))

for _, path in ipairs(listfiles("config")) do
    print(path, isfile(path))
end

Check before you read

readfile errors on a file that doesn't exist. Check with isfile(path) first or wrap it in pcall. In an autoexec script that's the difference between a clean join and an error every single time.

Reading

Writing

Folders

Loading

Assets

getcustomasset turns a workspace file into an rbxasset:// URL Roblox can render, which is how you get a local image into an ImageLabel or a Drawing object.

Removing