readfile

Reads a file from Workspace.

Syntax

Signature
readfile(Path: string) -> string

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
PathstringPath relative to the sandboxed Workspace.

Returns

TypeDescription
stringComplete file contents.

Notes

Files larger than 16 MiB and invalid or unreadable paths raise errors.

Example

Luau
local Path = "Examples/Message.txt"
writefile(Path, "Hello from Workspace")

if isfile(Path) then
    local Text = readfile(Path)
    print(Text)
end