Saving and Loading an R15 Character appearance

I need to be able to save the appearance of a character, and then later load and set that appearance.
All things relating to the character appearance, such as accessories in the form of ‘hats’ or clothing, I can do just fine.
What is giving me trouble is the R15 meshparts for the body.
I had originally forgotten that a meshpart MeshId can not be set during a running game, and thus wasted a lot of time on that :stuck_out_tongue:

So then I used…
local info = game:GetService("Players"):GetCharacterAppearanceInfoAsync(player.UserId)

info, holds the following categories…
bodyColors
assets
defaultPantsApplied
defaultShirtApplied
playerAvatarType
scales

So, the assets sub category is the only one that should have the characters body information
Now this is where it gets confusing…

If I have a default R15 character, the only thing I get in assets is
“Pants” (I don’t want to be nakey) with the asset id number.
there is nothing referencing the default meshparts for the body.

If I have my normal avatar, which is a character composed of multiple packages, what I get in assets is
“RightArm”
“LeftArm”
“RightLeg”
“LeftLeg”
“Torso”
each one of these has an asset id.
if I use InsertService:LoadAsset I get a model for each of these, and iterating through the model I find several folders, R15 being one of them, thus I can iterate through the R15, and find the meshparts for the body, such as the Torso model, has an R15 folder, and in that folder it has UpperTorso and LowerTorso. (One annoying thing, is that these parts can be referenced in lua script, but if you try to parent them to workspace, or a folder in workspace, then do not exist, such as if I try to parent the model from InsertService to workspace, the model shows up, but with empty folders, all empty except the R6 which holds one animation obejct)

So with an avatar using package parts, I can get the mesh parts (though the attachment for the Root joint is at the wrong position in the ‘Torso->R15->LowerTorso’ object

What I am thinking is this…
When a player loads a saved character, I need to totally rebuild their character with a default roblox character, without killing them (I have no idea how to do this)

Then once they are default, I can look through the saved id numbers for those packages such as LeftArm, RightArm, Torso… etc… and if they exist replace the default mesh body parts with those.

Then I would need to get the attachment cframes from my saved data (since I can’t trust the ones from the packages, being that RootRigAttachment was the wrong offset) and apply those to the attachments

Then have humanolid do a BuildRigFromAttachments.

So my questions are as follows…

  1. Is this how it should be done? Or is there a alternative, or simpler way to save and reload a player’s character?

  2. How do I get the default meshparts while in a running game, since I have no asset id’s for them?

  3. For a BuildRigFromAttachments I need to remove the old parts and have the new parts in the character, so how do I do this without killing the character?

Thanks for any help on this.

I read the OP multiple times and I still don’t understand why you need to save the Character, unless you are making an Avatar Editor then that makes sense.

If you are making an Avatar Editor then you can import every Asset needed into Studio then you put them in Folders, and then you create a Dictionary with a reference to the Folders and Instances, so you don’t have to even know the Package ID anymore.


Here’s an answer to Question #3

Not sure if this is enabled yet

https://www.robloxdev.com/api-reference/function/Humanoid/GetBodyPartR15

https://www.robloxdev.com/api-reference/function/Humanoid/ReplaceBodyPartR15

if not then you can set the Death Humanoid State Enabled to false.

1 Like

As far as #2 I agree there should be a better method to find default meshes. As far as I know, it is set by a character model Roblox created: https://www.roblox.com/library/1664543044/R15MrGreyNew

The problem is if this gets updated to a new model then the meshes don’t line up right and we don’t have a way to tell what model to use. I think I found this model by importing the animation editor plugin (new one) and poking around.

The purpose is that when players log into the game (the are allowed their default clothing), and they dress up (character edit) they can save their character and be able to load it again, even if the next time they log in with a different package type.

Since the saves are taking what the player’s avatar is currently wearing, I don’t see it possible to import every possible asset that a player might be wearing.

The two BodyPartR15 functions in humanoid are not Enabled yet :frowning:

When I try to get the package with…
local assetIds = AssetService:GetAssetIdsForPackage(1664543044) --id for R15MrGreyNew
I get the error
HTTP 400 (HTTP/1.1 400 Bad Request)

however, if I try
local assetIds = AssetService:GetAssetIdsForPackage(193700907) --id for Circuit Breaker

it loads correctly.

So I guess that MrGrey isn’t a valid package to use with this :frowning:

1 Like

So the remaining question that needs an answer is how do I get the asset id’s for the default roblox R15 character so that I can ‘in game’ create these parts and have the humanoid rebuild the rig with them.

Thanks

I ran across this…

1 Like

Get the rig model of your choice, name it StarterCharacter.
Place in it StarterPlayer.

Now type this:

local players = game:GetService("Players")

local function LoadCharacterAppearance(player)
	for _, child in pairs(players:GetCharacterAppearanceAsync(player.UserId):GetChildren()) do
		player:LoadCharacterAppearance(child)
	end
end

players.PlayerAdded:Connect(function (player)
	player.CharacterAdded:Connect(function (character)
		LoadCharacterAppearance(player)
	end)
end)


Thats what I do here

( Oh you found a solution )

1 Like