I have a R15 StarterCharacter with most basic dummy mesh parts. I wanted to start the game and be loaded as any model I wanted to be.
local AssetService = game:GetService("AssetService")
local InsertService = game:GetService("InsertService")
local packageId = 880489723
local assetIds = AssetService:GetAssetIdsForPackage(packageId)
player = game.Players:GetPlayerFromCharacter(characterModel)
for i, assetId in ipairs(assetIds) do
local model = InsertService:LoadAsset(assetId)
for _, child in pairs(model:GetDescendants()) do
player:LoadCharacterAppearance(child)
end
end
As you can see I am trying to load this package as a test.
With above code, I see the mesh parts being replaced one by one. But right when Upper Torso is replaced my humanoid dies. Is there a way to load any package and have your StarterCharacter spawned as that in the script?
Disable the Humanoid state “Dead”, CFrame new parts to old part’s CFrame, destroy old part, parent new part to character, humanoid:BuildRigFromAttachments(), and then re-enable the “Dead” state.
Hacky, but works.
Won’t work for any rigs that are built without the use of Attachments.
Alternatively you could build the character before setting the player’s character (making use of Players.CharacterAutoLoads)