# This file is automatically generated. Please don't edit it manually. # To submit a bug report on the content, see # https://devforum.roblox.com/c/bug-reports/documentation-issues/72 name: AssetService type: class memory_category: Instances summary: | A non-replicated service that handles asset-related queries to the Roblox web API. description: | **AssetService** is a non-replicated service that handles asset-related queries to the Roblox web API. code_samples: [] inherits: - Instance descendants: [] tags: - NotCreatable - Service deprecation_message: '' properties: - name: AssetService.AllowInsertFreeAssets summary: | Controls whether `Class.AssetService:LoadAssetAsync()` can load assets that are not owned by the experience creator. description: | This property can only be modified in Studio's **Experience Settings** by changing **Allow Loading Third Party Assets**. When `false` (default), `Class.AssetService:LoadAssetAsync()` can only load assets that meet one of the following: - The asset must be **created or owned** by the game creator. - The asset must be **shared** by the asset owner. - The asset must be owned by Roblox. When `true`, `Class.AssetService:LoadAssetAsync()` can additionally load any public free asset on the Creator Store. code_samples: [] type: boolean tags: [] deprecation_message: '' security: read: RobloxScriptSecurity write: RobloxScriptSecurity thread_safety: ReadSafe category: Behavior serialization: can_load: true can_save: true capabilities: [] methods: - name: AssetService:ComposeDecalAsync summary: | Creates a Decal instance that uses composite PBR textures created by layering the provided textures in the order they are provided in the `layers` array. Textures layer based on the alpha value of the ColorMap. description: | Creates a new `Class.Decal` that contains a composed texture derived from one or more layered texture sets. Each set can include color, roughness, metalness, and normal maps. Each `layer` is composited in the order they are provided, with the ColorMap alpha channel used to determine blending. - There is a limit of 8 layers. - Layering order is bottom-to-top: the first layer in the list provides the bottom-most textures. - Each dictionary table should contain the following key-value pairs: - **ColorMap**: A `Datatype.Content` referencing a color (albedo) texture by assetId. - **RoughnessMap**: A `Datatype.Content` referencing a roughness texture by assetId. - **MetalnessMap**: A `Datatype.Content` referencing a metalness texture by assetId. - **NormalMap**: A `Datatype.Content` referencing a normal texture by assetId. - `ColorMap` is mandatory in every layer. The ColorMap's alpha channel is used to control blending of the entire layer. - `NormalMap`, `MetalnessMap`, `RoughnessMap` are optional. If omitted, this layer doesn't perform any blending for those maps. code_samples: - AssetService-ComposeDecalAsync parameters: - name: layers type: Array default: summary: | An array of `Dictionary` tables that maps PBR names to ContentID. returns: - type: Decal summary: | A new `Class.Decal` containing the composed texture set. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: [] - name: AssetService:CreateAssetAsync summary: | Uploads a new asset to Roblox from the given object. description: | Uploads a new asset to Roblox from the given object. Currently, this method can only be used in locally loaded plugins and uploads assets without prompting first. code_samples: - AssetService-CreateAssetAsync parameters: - name: object type: Object default: summary: | The object to be created as an asset. - name: assetType type: AssetType default: summary: | Currently supported types are: - `Enum.AssetType.Model` – with `object` as any valid `Class.Instance` root. - `Enum.AssetType.Plugin` – with `object` as any valid `Class.Instance` root. - `Enum.AssetType.Mesh` – with `object` as any valid `Class.EditableMesh` root. - `Enum.AssetType.Image` – with `object` as any valid `Class.EditableImage` root. - name: requestParameters type: Dictionary default: nil summary: | Options table containing asset metadata: - `Name` – Name of the asset as a string. Defaults to `[object.Name]`. - `Description` – Description of the asset as a string. Defaults to `"Created with AssetService:CreateAssetAsync"`. - `CreatorId` – ID of the asset creator as a number. Defaults to the logged in Roblox Studio user for Plugin context. Required for Open Cloud Luau Execution context. - `CreatorType` – `Enum.AssetCreatorType` indicating the type of asset creator. Defaults to `Enum.AssetCreatorType.User` in Plugin context. Required for Open Cloud Luau Execution context. - `IsPackage` – Boolean value, only applicable to the `Enum.AssetType.Model` type. Defaults to `true`. returns: - type: Tuple summary: | The `Enum.CreateAssetResult` and asset ID pair if successful. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetCreateUpdate - name: AssetService:CreateAssetVersionAsync summary: | Uploads a new version for an existing asset from the given object. description: | Uploads a new version for an existing asset from the given object. Currently, this method can only be used in locally loaded plugins and uploads assets without prompting first. code_samples: - AssetService-CreateAssetVersionAsync parameters: - name: object type: Object default: summary: | The object to be created as an asset. - name: assetType type: AssetType default: summary: | Currently supported types are: - `Enum.AssetType.Model` – with `object` as any valid `Class.Instance` root. - `Enum.AssetType.Plugin` – with `object` as any valid `Class.Instance` root. - `Enum.AssetType.Mesh` – with `object` as any valid `Class.EditableMesh` root. - `Enum.AssetType.Image` – with `object` as any valid `Class.EditableImage` root. - name: assetId type: int64 default: summary: | The ID of the asset for the new version. - name: requestParameters type: Dictionary default: nil summary: | Options table containing asset metadata: - `Name` – A `string`. Name of the asset. Default: object.Name. - `Description` – A `string`. Description of the asset. Default: "Created with AssetService:CreateAssetAsync". - `CreatorId` – A `number`. ID of the asset creator. Default: The logged in Roblox Studio user for Plugin context. Required for Open Cloud Luau Execution context. - `CreatorType` – A `Enum.AssetCreatorType`. Type of asset creator. Default: `Enum.AssetCreatorType.User` in Plugin context. Required for Open Cloud Luau Execution context. - `IsPackage` – A `bool`. Only applicable to the `Enum.AssetType.Model` type. Default: true. returns: - type: Tuple summary: | The `Enum.CreateAssetResult` and asset version number pair if successful. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetCreateUpdate - name: AssetService:CreateEditableImage summary: | Creates a new `Class.EditableImage`. description: | Creates a new `Class.EditableImage`. By default, the resolution is set at 512×512, but you can specify a different size using the method's option table. If the device‑specific editable memory budget is exhausted, creation fails and this method returns `nil`. code_samples: [] parameters: - name: editableImageOptions type: Dictionary? default: summary: | Options table containing controls for the method: - `Size` – A `Datatype.Vector2` that specifies the image's desired width and height. returns: - type: EditableImage summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - DynamicGeneration - name: AssetService:CreateEditableImageAsync summary: | Creates a new `Class.EditableImage` object populated with the given image. description: | Creates a new `Class.EditableImage` object populated with the given texture. Non-asset texture IDs such as `rbxthumb://` are supported. If using an image asset, it must be associated with and/or owned by a creator of the experience, or it must have been created inside the experience. If the device-specific editable memory budget is exhausted, creation will fail and this method will return `nil`. See the `Class.EditableImage` documentation for special considerations when using this API. code_samples: [] parameters: - name: content type: Content default: summary: | Reference to asset content stored externally or as an object within the place, wrapping a single value of one of the supported `Enum.ContentSourceType` values. - name: editableImageOptions type: Dictionary? default: summary: | Table containing options for the created `Class.EditableImage`. Currently no options are available since resizing via `Class.EditableImage.Size|Size` is not supported. returns: - type: EditableImage summary: | A new `Class.EditableImage` containing the provided image. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:CreateEditableMesh summary: | Creates a new, empty `Class.EditableMesh`. description: | Creates a new, empty `Class.EditableMesh`. Vertices, triangles, and their attributes can be added dynamically to it. If the device‑specific editable memory budget is exhausted, creation will fail and this method will return `nil`. code_samples: [] parameters: - name: editableMeshOptions type: Dictionary? default: summary: | Table containing options for the created `Class.EditableMesh`. Currently no options are available since `Class.EditableMesh.FixedSize|FixedSize` will always be `false` for empty editable meshes. returns: - type: EditableMesh summary: '' tags: [] deprecation_message: '' security: None thread_safety: Unsafe capabilities: - DynamicGeneration - name: AssetService:CreateEditableMeshAsync summary: | Returns a new `Class.EditableMesh` object created from an existing mesh content ID. description: | Returns a new `Class.EditableMesh` object created from an existing `Class.EditableMesh` or mesh `Datatype.Content` ID. By default, an `Class.EditableMesh` created from this method will be fixed size such that mesh data can only be modified, not added nor removed. A fixed size `Class.EditableMesh` consumes less memory and should be preferred when possible. If the device-specific editable memory budget is exhausted, creation will fail and this method will return `nil`. See the **Enabling EditableMesh for Published Experiences** and **Permissions** sections of `Class.EditableMesh` for special considerations when using this API. code_samples: [] parameters: - name: content type: Content default: summary: | Reference to asset content stored externally or as an object within the place, wrapping a single value of one of the supported `Enum.ContentSourceType` values. - name: editableMeshOptions type: Dictionary? default: summary: | Options table containing controls for the method: - `FixedSize` – A `bool`. Default value is `true`, and the returned `Class.EditableMesh` will not allow you to add or remove vertices, only modify their values. Set to `false` if the ability to change the mesh topology is required, at the expense of using more memory. returns: - type: EditableMesh summary: | The new `Class.EditableMesh` instance. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:CreateMeshPartAsync summary: | Creates a new `Class.MeshPart` with a specified mesh ID and an optional table of fidelity values. description: | This method creates a `Class.MeshPart` with a specified `Class.MeshPart.CollisionFidelity|CollisionFidelity`, `Class.MeshPart.RenderFidelity|RenderFidelity`, and `Class.MeshPart.FluidFidelity|FluidFidelity`. Because `Class.MeshPart.MeshId` is read only, this method is for creating a mesh with any mesh ID through scripts, without having to clone an existing `Class.MeshPart`. It throws errors if creation fails. code_samples: [] parameters: - name: meshContent type: Content default: summary: | Reference to asset content stored externally or as an object within the place, wrapping a single value of one of the supported `Enum.ContentSourceType` values. - name: options type: Dictionary default: nil summary: | Options table containing one or more controls for the method: - `CollisionFidelity` – The value of `Class.MeshPart.CollisionFidelity|CollisionFidelity` in the resulting part. Defaults to `Enum.CollisionFidelity.Default` if the option is absent or the `options` table is `nil`. - `RenderFidelity` – The value of `Class.MeshPart.RenderFidelity|RenderFidelity` in the resulting part. Defaults to `Enum.RenderFidelity.Automatic` if the option is absent or the `options` table is `nil`. - `FluidFidelity` – The value of `Class.MeshPart.FluidFidelity|FluidFidelity` in the resulting part. Defaults to `Enum.FluidFidelity.Automatic` if the option is absent or the `options` table is `nil`. returns: - type: MeshPart summary: '' tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Basic - name: AssetService:CreatePlaceAsync summary: | Clones a place through the given `templatePlaceID`. description: | Clones a place through the given `templatePlaceID` and returns the `Class.DataModel.PlaceId|PlaceId` of the new place, which you can use with `Class.TeleportService`. The clone place displays within the inventory of the place's creator with the given name and description. Note that the template place must have template copying enabled through place settings. You cannot use this method to clone places that you don't own. Frequent use of this API is not recommended, particularly if the created places contain scripts, as updating the code in a large volume of places quickly becomes infeasible. For user-generated worlds, consider serializing user creations and saving them in `Class.DataStore|DataStores` instead. code_samples: [] parameters: - name: placeName type: string default: summary: | Name of the new place. - name: templatePlaceID type: int64 default: summary: | `Class.DataModel.PlaceId|PlaceId` of the place to clone. - name: description type: string default: summary: | Description of the new place. returns: - type: int64 summary: | `Class.DataModel.PlaceId|PlaceId` of the new place. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetCreateUpdate - name: AssetService:CreatePlaceInPlayerInventoryAsync summary: | Clones a place through the given `templatePlaceID` and puts it into the inventory of the given player. description: '' code_samples: [] parameters: - name: player type: Instance default: summary: '' - name: placeName type: string default: summary: '' - name: templatePlaceID type: int64 default: summary: '' - name: description type: string default: summary: '' returns: - type: int64 summary: '' tags: - Yields deprecation_message: | This method has been removed and is no longer functional. security: None thread_safety: Unsafe capabilities: - AssetCreateUpdate - name: AssetService:CreateSurfaceAppearanceAsync summary: | Creates a new `Class.SurfaceAppearance` object using the provided content maps. description: | Creates a new `Class.SurfaceAppearance` object using the provided content maps. Currently, content only supports `Class.EditableImage` and only content maps can be specified, but functionality will expand to include asset IDs as input. If you need to achieve this today, you can create an `Class.EditableImage` from an asset ID using the following: `Class.AssetService:CreateEditableImageAsync(Content.fromUri(uri))` Default values will be used for all other `Class.SurfaceAppearance` properties. code_samples: - AssetService-CreateSurfaceAppearanceAsync parameters: - name: content type: Dictionary default: summary: | Dictionary containing the following key-value pairs: - `ColorMap` — A `Datatype.Content` object that contains the color map. Default is `nil`. - `MetalnessMap` — A `Datatype.Content` object that contains the metalness map. If more than one channel is present, only the red channel is used. Default is `nil`. - `NormalMap` — A `Datatype.Content` object that contains the normal map. Default is `nil`. - `RoughnessMap` — A `Datatype.Content` object that contains the roughness map. If more than one channel is present, only the red channel is used. Default is `nil`. - `EmissiveMask` — A `Datatype.Content` object that contains the emissive mask. If more than one channel is present, only the red channel is used. Default is `nil`. returns: - type: SurfaceAppearance summary: | A new `Class.SurfaceAppearance` instance with the given maps from the `content` parameter. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - Basic - name: AssetService:GetAssetIdsForPackageAsync summary: | Returns an array of asset IDs that are contained in a specified package. description: | Returns an array of asset IDs that are contained in a specified package. code_samples: [] parameters: - name: packageAssetId type: int64 default: summary: '' returns: - type: Array summary: | Asset IDs that are contained in a specified package. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:GetAssetIdsForPackage summary: | Returns an array of asset IDs that are contained in a specified package. description: '' code_samples: [] parameters: - name: packageAssetId type: int64 default: summary: '' returns: - type: Array summary: | Asset IDs that are contained in a specified package. tags: - Yields - Deprecated deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:GetAudioMetadataAsync summary: | Provides relevant metadata about a specific audio source. description: | Provides relevant metadata about a specific audio source (artist, title, duration, type, etc.). code_samples: - AssetService-GetAudioMetadataAsync parameters: - name: idList type: Array default: summary: | Array of asset or content IDs for which to retrieve metadata. Max batch size is 30. returns: - type: Array summary: | Array of dictionary tables in the same order as the request, where each dictionary contains the following metadata for its asset/content: - `AssetId` (string) - `Title` (string) - `Artist` (string) - `Duration` (number) in seconds - `AudioType` (`Enum.AudioSubType`) Note that if an error occurs on fetching metadata for any of the requested assets, for example the asset ID doesn't exist, its dictionary table is still included in the returned array but it only contains the `AssetId` field for reference purposes. Additionally, if the `AudioType` cannot be determined for a given asset (perhaps because it's private audio), the resulting dictionary will not contain an `AudioType` entry. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:GetBundleDetailsAsync summary: | Returns details of the contents of specified bundle. description: | This function returns details of the contents of the specified bundle. If the bundle ID does not exist, it throws `HTTP 400 (Bad Request)`. If `bundleId` is not convertible to an integer, it throws `Unable to cast string to int64`. code_samples: - getting-bundle-details parameters: - name: bundleId type: int64 default: summary: | The ID of the specified bundle. returns: - type: Dictionary summary: | Dictionary with the following key-value pairs containing details about the specified bundle: - `Id` — Bundle ID (same as passed `bundleId` argument) - `Name` — Bundle name - `Description` — Bundle description - `BundleType` — String representing the `Enum.BundleType`, for example `"BodyParts"` or `"DynamicHead"` - `Items` — Array of items in the bundle, each with details represented through the following keys: - `Id` — Item ID - `Name` — Item name - `Type` — Item type such as `"Asset"` . tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:GetCreatorAssetID summary: | Returns the UserId of the account who created the creationID asset. description: | The GetCreatorAssetID function returns the `Class.Player.UserId` of the account who created the _creationID_ asset. This member is broken and doesn't function correctly. Avoid using it. code_samples: [] parameters: - name: creationID type: int64 default: summary: '' returns: - type: int64 summary: '' tags: - Yields - Deprecated deprecation_message: | This item is deprecated and no longer functions correctly. Do not use it for new work. security: None thread_safety: Unsafe capabilities: [] - name: AssetService:GetGamePlacesAsync summary: | Returns a `Class.StandardPages` object which contains the name and `Class.DataModel.PlaceId|PlaceId` of places within the current experience. description: | Returns a `Class.StandardPages` object which contains the name and `Class.DataModel.PlaceId|PlaceId` of places within the current experience. code_samples: - AssetService-GetGamePlacesAsync1 parameters: [] returns: - type: Instance summary: '' tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRead - name: AssetService:LoadAssetAsync summary: | Loads a `Class.Model` instance given its asset ID. This is the modern replacement for `Class.InsertService:LoadAsset()` and supports loading third-party assets. description: | Loads the latest version of an asset from the given `assetId` and returns it wrapped in a `Class.Model`. This method is the modern replacement for `Class.InsertService:LoadAsset()` and `Class.InsertService:LoadAssetVersion()` methods. Calls to this function may fail if the asset does not exist, or if the server providing the model is having problems. It is recommended to wrap calls to this function in `pcall()` to handle potential errors. ```lua local AssetService = game:GetService("AssetService") local assetId = 257489726 local success, model = pcall(AssetService.LoadAssetAsync, AssetService, assetId) if success and model then print("Model loaded successfully") model.Parent = workspace else warn("Model failed to load:", model) -- 'model' will contain the error message end ``` #### Script Sandbox Security For enhanced security, the returned `Class.Model` is sandboxed by default (`Class.Model.Sandboxed|Sandboxed` is `true`) and has no script `Enum.SecurityCapability|Capabilities`. This prevents untrusted scripts descending from the returned Model from running. To enable scripts in a model you trust, you can manually grant a safe set of `Enum.SecurityCapability|Capabilities` on the Model after loading. #### Third-Party Asset Loading Unlike `Class.InsertService:LoadAsset()`, this method can load public assets created by **third parties** (assets not owned by the experience creator). To enable this functionality, you must first enable the **Allow Loading Third Party Assets** setting in **Home > Game Settings > Security**. If this setting is disabled (which it is by default), `LoadAssetAsync` will only load assets that are owned by the experience creator, behaving identically to the old `Class.InsertService:LoadAsset()` security check. code_samples: [] parameters: - name: assetId type: int64 default: summary: | The asset ID number of the asset being loaded. returns: - type: Instance summary: | A `Class.Model` instance containing the loaded asset. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetRequire - name: AssetService:PromptCreateAssetAsync summary: | Allows in-experience asset creation for users by prompting a publish dialog. description: | Allows in-experience asset creation for users by prompting a publish dialog. When called, it presents a dialog to the user, allowing them to enter a name, description, and preview the asset. Upon submitting, it saves the asset to the user's inventory. Can only be invoked on the server side. code_samples: [] parameters: - name: player type: Player default: summary: | The user who submits an asset creation. - name: instance type: Instance default: summary: | The asset to be created. Currently can't contain scripts or nest non-public assets. - name: assetType type: AssetType default: summary: | The asset type. Currently can only be `Enum.AssetType.Model`. returns: - type: Tuple summary: | The `Enum.PromptCreateAssetResult` and asset ID pair if successful. tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetCreateUpdate - name: AssetService:PromptImportAnimationClipFromVideoAsync summary: '' description: '' code_samples: [] parameters: - name: player type: Player default: summary: '' - name: progressCallback type: Function default: summary: '' returns: - type: Tuple summary: '' tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetManagement - name: AssetService:SavePlaceAsync summary: | Saves the state of the current place. description: | Saves the current state of the place. Keep in mind the following guidelines and restrictions: - This method only works for places that are created with `Class.AssetService:CreatePlaceAsync()` or that have the API enabled through the place's settings. - This method overwrites the previous state of the place. To revert a save, publish an older version of the place. - There are cases when saves can occur simultaneously in Studio and in multiple experience servers. The order of the saves happen in the order they are called. - An active Team Create session in Studio blocks all saves from occurring. code_samples: [] parameters: - name: requestParameters type: Dictionary? default: summary: | Optional dictionary that includes `SaveWithoutPublish`, a boolean indicating whether to save with publish or without publish, and `PlaceId`, the destination place ID to save over. An example usage would be: AssetService:SavePlaceAsync({PlaceId = 1, SaveWithoutPublish = true}). If PlaceId is not provided, the default behavior will save over the current original place which is calling SavePlaceAsync. If SaveWithoutPublish is not provided, the default behavior is SaveWithoutPublish=false. returns: - type: () summary: '' tags: - Yields deprecation_message: '' security: None thread_safety: Unsafe capabilities: - AssetCreateUpdate - name: AssetService:SearchAudioAsync summary: | Finds audio assets matching a variety of search criteria. description: | Returns a `Class.AudioPages` object containing the result of the given search. Will not return fields with empty values. Note that this method has a low HTTP request limit and can throw an error, so it should always be wrapped in `pcall()` for error handling. Possible error messages include:
| Error Message | Reason |
|---|---|
| HTTP 429 (Too Many Requests) | Class.AssetService:SearchAudio() has been called too many times. |
| Unexpected type for data, expected array got null | The keyword argument was filtered. |