Syntax
getcustomasset(path: string): stringAliases
getsynassetArguments
| Name | Type | Description |
|---|---|---|
path | string | Workspace-relative path to the file or folder. |
Returns
| Name | Type | Description |
|---|---|---|
assetId | string | Custom 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