Volt

getcustomasset

Returns a content URL for a local file that can be used in Roblox.

Syntax

getcustomasset(path: string) -> string

Parameters

ParameterTypeDescription
pathstringThe file path

Returns

TypeDescription
stringA content URL usable in Roblox

Description

getcustomasset converts a local file into a content URL that Roblox can use for images, sounds, and other assets.

Example: Custom Image

-- Save an image to the workspace
-- (assume image data is obtained somehow)
writefile("myimage.png", imageData)

-- Get a usable URL
local imageUrl = getcustomasset("myimage.png")

-- Use it in a GUI
local imageLabel = Instance.new("ImageLabel")
imageLabel.Image = imageUrl
imageLabel.Parent = someGui

Example: Custom Sound

-- Get URL for a local sound file
local soundUrl = getcustomasset("mysound.mp3")

-- Create and play the sound
local sound = Instance.new("Sound")
sound.SoundId = soundUrl
sound.Parent = workspace
sound:Play()

Supported Formats

TypeFormats
ImagesPNG, JPG, JPEG
AudioMP3, OGG, WAV

Notes

  • The file must exist in the workspace folder
  • The returned URL is only valid for the current session
  • Large files may take time to load

Aliases

  • getsynasset

On this page