How do I spawn a UGC bundle in Workspace via script?

I’m trying to load a bundle (like the Realistic Pigeon) into my Roblox game via script. I’ve tried using both AvatarEditorService and InsertService, but I’m running into issues nothing seems to work to make the bundle appear on a dummy rig in Workspace.

Does anyone know the correct way to programmatically display a bundle in-game? I just want it to show on a rig called “Dummy” for catalog/display purposes.

Any guidance or examples would be really appreciated!

1 Like

Not exactly what I’m looking for I’m looking for a way to display a bundle from the marketplace in my roblox game dynamically like with code like insert the bundle character into the game

or
https://create.roblox.com/store/asset/80070066653819/Ultimate-Loader

1 Like

This is actually a better way, i just noticed it but i did noticed that a bundle might actually have 2 Outfit ID and one of those might just have a head in the assets table which happened to me when i was testing, found a way around it though, here is the code that worked for me:

local AvatarEditorService = game:GetService("AvatarEditorService")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")

function LoadBundle(bundle)
	local Details = AvatarEditorService:GetItemDetails(bundle, Enum.AvatarItemType.Bundle)
	local OutfitID
	
	for i, v in pairs(Details.BundledItems) do
		if v.Type == "UserOutfit" then
			if #AvatarEditorService:GetOutfitDetails(v.Id).Assets > 2 then
				OutfitID = v.Id
			end
		end
	end

	local Description = Players:GetHumanoidDescriptionFromOutfitId(OutfitID)
	local Rig = Players:CreateHumanoidModelFromDescription(Description, Enum.HumanoidRigType.R15)
	Rig.Parent = workspace
	return Rig
end

credits to @TurboDeveloper7

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.