Hello Creators!
While we strive to make the best tools to help you create, we recognize that often, you know best. Which is why today, we are excited to announce two new Luau APIs that drastically expand what Creator Luau tooling is capable of.
The new APIs AssetService:CreateAssetAsync
and AssetService:CreateAssetVersionAsync
enable third-party Luau tooling to programmatically create and upload assets to your inventories.
These two functions are intended for use in both Studio plugins and the recently announced Open Cloud Engine API for Executing Luau.
The two functions have the following signatures:
AssetService:CreateAssetAsync(
object: Object,
assetType: Enum.AssetType,
options: table
): Enum.CreateAssetResult, number | string
AssetService:CreateAssetVersionAsync(
object: Object,
assetType: Enum.AssetType,
targetAssetId: number,
options: table
): Enum.CreateAssetResult, number | string
-- return type is number if enum is 'Success', otherwise string
-- options table:
{
Name: string, -- default: object.Name if applicable, otherwise non-optional
Description: string, -- default: "Created with AssetService:CreateAssetAsync"
CreatorId: number, -- default: logged in user (non-optional in OC Luau tasks)
CreatorType: Enum.AssetCreatorType, -- default: User (non-optional in OC Luau tasks)
IsPackage: boolean, -- default: true
}
Today, CreateAssetAsync
supports 4 asset types:
-
Enum.AssetType.Model
with object = any validInstance
root- By default uploaded Models are Packages, to create non-package Models set the
IsPackage
option tofalse
- By default uploaded Models are Packages, to create non-package Models set the
-
Enum.AssetType.Plugin
with object = any validInstance
root -
Enum.AssetType.Mesh
with object =EditableMesh
-
Enum.AssetType.Image
with object =EditableImage
Note that asset update is only supported for Model and Plugin asset types.
Getting Started
In Open Cloud Luau Tasks, you can just go ahead and call the API, it should work without any extra steps.
In Studio, enable the beta feature ”CreateAssetAsync Luau API”
and make a local plugin, or call it from the command bar!
For more information on the API, see the documentation here:
- AssetService:CreateAssetAsync | Documentation - Roblox Creator Hub
- AssetService:CreateAssetVersionAsync | Documentation - Roblox Creator Hub
Note: while CreateAssetAsync
unconditionally supports EditableMesh/EditableImage
, creating new Editablemesh/Images from cloud Luau tasks requires that the place used for the task have the Mesh/Image API enabled. See the In-Experience Mesh & Image API announcement for instructions on enabling.
Limitations
- As stated, these APIs are intended for creator use-cases and thus are not available in-experience. Read about upcoming appropriate in-experience APIs in the In-Experience Mesh & Image APIs announcement
- The APIs will not work when called from plugins acquired from the Creator Store (see below for explanation)
- If there are unpublished content references in the subtree of a Model or Plugin (e.g. an
EditableImage
reference), the API call will fail, you should upload these first before uploading the containing model/plugin. - The APIs are currently limited at 30 requests per minute
Risks
Assets uploaded via these APIs will be reviewed and moderated identically to assets uploaded from existing Studio features (e.g. 3D Import/Bulk Importer) and are subject to the same consequences if they violate our policies. You are responsible for assets uploaded on your behalf!
For this reason, if you have the beta feature enabled, you should be more cautious when executing or copying local plugins that you have not written yourself or reviewed the code.
Note that this beta feature will not be automatically enabled even if you have auto-enrolled on.
What’s next
Enabling For Creator Store Plugins
As alluded to in the “Risks” section above, letting untrusted code upload assets on your behalf can be dangerous. Because of this, we need to give users the necessary tools to protect themselves from potentially malicious plugins. Next year we plan to introduce a new feature that will let users grant and withdraw permission to use these APIs for individual plugins; and, for plugins that have the permission, review and audit the assets a plugin is attempting to upload before they are uploaded.
Implementing this protection is complex, and will take some time. We recognize, however, that these APIs are extremely useful, which is why we chose to make them available to local plugins today, while we work on the permission system for Creator Store plugins.
We want your feedback!
First off, please let us know what other asset types you would like to see supported by this API!
We will be eagerly watching this thread for issues, requests, and comments you may have. These APIs are for you and your workflows, and we are committed to ensuring they serve you well!
Speaking of your workflows, supporting your tooling, and the ability for your tools and workflows to gracefully interact with Studio and our first party features will be an increasing priority for us moving forward. This API along with the recent Script Sync, and Open Cloud Luau tasks announcements are the first steps in a larger mission to ensure that you have the ability to create using the tools that you want and make you the most efficient.
Thanks!
@bluestann @icemountainrbx @Rusi_002 @ContextLost @DevelopmentDeadline @itsfrank17