With the in-game asset creation feature, you can allow your users to save creations they made in your game to their inventories. Your users can use these in-game creations just like any other asset. Additionally, these creations attribute to your game when displayed on the Roblox platform, so any user can use the attribution link to come to your game and create their own.
For example, you can enable users to create custom creatures as pets in your game, and allow them to save their favorite pets to their inventories. You have full control to specify which objects users can modify and save from your game. Users in turn can display their creations on their profiles with attribution to your game, boosting visibility of your game.
Supported asset types and limits
Just like all assets on the platform, in-game creations are subject to asset moderation. Currently, you can only allow users to create packages from your game. These packages can't contain any scripts or private assets, such as audio, video, and nested packages. If the system detects scripts or private assets in a package that can be saved by users, it blocks the in-game save action by hiding the save prompt for users.
When you are running or testing your game and add scripts or private assets as part of an in-game creation, it fails to save and prompts error messages to the Studio Output window or the Developer Console.
Enabling in-game asset creation
To enable in-game asset creation for your users, use the AssetService:PromptCreateAssetAsync() API method in a server-side script, along with other creation logic. Specify which instances in your game you want to enable this functionality, set a custom trigger (such as a UI icon) for invoking the method, and listen for client remote events for saving assets.
AssetService:PromptCreateAssetAsync() takes the following parameters:
- A Player object representing the user who submits an asset creation.
- An Instance object representing the asset for creation.
- The Enum.AssetType, which is currently limited to Enum.AssetType.Model.
When the server invokes AssetService:PromptCreateAssetAsync(), it prompts a Submit Package dialog on the client, so the user who triggers the save action can enter a name and description for the package. Roblox provides the dialog UI out-of-the-box, as the save workflow is a platform-level functionality.
The following example server-side script prompts users to save a car that they paint in a game:
Example Script for In-game Asset Creation
-- Define the AssetService variable
local AssetService = game:GetService("AssetService")
-- Set up PromptCreateAssetAsync() for prompting the submission dialog
local function CreateAsset(player, instance)
local complete, result, assetId = pcall(function()
return AssetService:PromptCreateAssetAsync(player, instance, Enum.AssetType.Model)
end)
if complete then
if result == Enum.PromptCreateAssetResult.Success then
print("successfully uploaded, AssetId:", assetId)
else
print("Received result", result)
end
else
print("error")
print(result)
end
end
-- Car painting logic omitted
-- Add an event handler
local function onUserPublish(player, promptObject)
-- User saves the car instance with the game's default color
if promptObject.Name == "car" then
CreateAsset(player, car)
elseif promptObject.Name == "CarPaintYellow" or promptObject.Name == "CarPaintBlue" or promptObject.Name == "CarPaintBlack" or promptObject.Name == "CarPaintRed" then
PaintCarColor(promptObject.Name)
end
end
PublishEvent.OnServerEvent:Connect(onUserPublish)
In-Experience Creation Demo Arena showcases an example on how you can use this feature. You can join the demo to walk through the in-game creation workflow as a user, or edit the place in Studio to reference the design.
Post-creation and attribution
After users create and save an asset from your game, they can find it in the following places:
- Their My Inventory page.
- The Creations tab of their Profile page.
- The Development Items tab under their Creator Dashboard Creations page.
- The Inventory tab of their Toolbox in Studio.
When users see in-game creations on their friends' profiles or inventories, they see attribution to the original game in which the asset was created. Users can click on the attribution link to redirect to the game page, so they can join the game and create their own.