Filesystem

getcustomasset

Copies an existing regular workspace file into ExtraContent/<hwid>/ and returns an rbxasset:// string for the copied asset path.

Syntax

getcustomasset(path: string): string
Aliases getsynasset

Arguments

NameTypeDescription
pathstringPath resolved inside the workspace after separator normalization and workspace-boundary checks. The target must exist and be a regular file; folders, invalid filenames, DOS device names, and blocked extensions are not accepted.

Returns

NameTypeDescription
assetIdstringString in the form rbxasset://<hwid>/<workspace-relative-path> using forward slashes for the relative path.

Description

Copies an existing regular workspace file into ExtraContent/<hwid>/ and returns an rbxasset:// string for the copied asset path.

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

Copy an existing workspace file into the asset folder and print the returned rbxasset path.

local path = "assets/example.txt"
writefile(path, "asset bytes")

local assetId = getcustomasset(path)
print(assetId)
print(getsynasset(path))