ReferenceFilesystem

writecustomasset

Writes a file and returns the asset id for it in one call.

Syntax

writecustomasset(path: string, content: string) -> string

Parameters

ParameterTypeDescription
pathstringWorkspace-relative file to create.
contentstringThe asset's bytes.

Returns

TypeDescription
stringAn rbxasset:// id for the written file.

Description

It is writefile followed by getcustomasset on the same path.

Example

local id = writecustomasset("example.txt", "hello")
print(id)
delfile("example.txt")

These are Game executor contracts. Check build requirements and session lifetimes before using them.