getcustomasset Synchronous
getsynasset
Turn a local file into a content ID that Roblox content properties can use. Kawaii copies the file into its local asset store and returns an rbxasset:// URI. Use it for a local image or other asset assigned to a Roblox content property. For a Drawing Image, assign file bytes to Data instead of this content ID.
getcustomasset(path: string) -> stringParameters
| Parameter | Type | Description |
|---|---|---|
path | string | Workspace-relative path to an existing media or asset file. |
Returns
stringA string beginning with rbxasset://kawaiilua/. It identifies the local asset, rather than containing the file’s bytes.
Usage notes
The property consuming the content ID must support the file’s format. The asset remains local; this function does not upload it.
For Drawing Image objects, assign readfile(path) to Data instead. Drawing.Data expects bytes, not a content ID.
Differences from Volt
Volt documents access through explicitly created workspace symlinks. Kawaii rejects symlinks in workspace paths; all workspace operations remain subject to its path containment checks.
Example
if isfile("images/icon.png") then
local contentId = getcustomasset("images/icon.png")
print(contentId)
end