ReferenceFilesystem

getcustomasset

Registers a workspace file as an asset address usable by the game. Assign the returned address to a compatible image or sound property. The underlying file must exist and contain a supported media format; a returned address does not convert arbitrary data into an image.

Syntax

getcustomasset(path: string) -> string

Also available as

getsynassetget_custom_asset

Parameters

ParameterTypeDescription
pathstringWorkspace-relative media file.

Returns

TypeDescription
stringAsset address for the local file.

Description

File operations are confined to the current workspace. Absolute paths and traversal outside it are not accepted. Use a file dialog when the user needs to choose an external file.

Example

if isfile("picture.png") then
    local image = Instance.new("ImageLabel")
    image.Image = getcustomasset("picture.png")
end

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