Filesystem

getcustomasset

Registers a workspace file as a custom asset and returns an asset URL usable by Roblox APIs.

Syntax

getcustomasset(path: string): string
Aliases getsynasset

Arguments

NameTypeDescription
pathstringWorkspace-relative path to the file or folder.

Returns

NameTypeDescription
assetIdstringCustom asset URL or content id that can be passed to Roblox APIs.

Description

Registers a workspace file as a custom asset and returns an asset URL usable by Roblox APIs.

Call it with 1 parameter(s): path. The argument table explains which values are required and which ones only refine the behavior.

It returns assetId (string). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Create an asset URL for a file stored in the workspace.

local path = "workspace/assets/icon.png"

if isfile(path) then
    local assetId = getcustomasset(path)
    print(assetId)
end