Help with loading custom characters

I have created a shop that allows players to “equip” custom characters (I’m calling them skins in my game) at any point while they are playing.
By custom characters I don’t mean a custom model, I’m still using a r15 block rig but with predetermined shirts/pants/accessories.

However the method I’m using to accomplish this is not very clean. Right now when a player clicks the equip button a server scripts clones the skin from server storage and replaces the players current character.

function loadCharacter(player, skin)
    player:ClearCharacterAppearance()
    local Skin = ss.Skins:WaitForChild(skin)
    local SkinClone = Skin:Clone()
    SkinClone:SetPrimaryPartCFrame(player.Character.PrimaryPart.CFrame)		
    if player.Character then		
        player.Character:Destroy()
    end
    player.Character = SkinClone
    SkinClone.Parent = game.Workspace

    print("Skin equiped!")	
end

My problem is, any time the player dies, changes teams or joins, their own character loads and I have to wait for their character to load and quickly reequip their skin. (Changing the player’s character really fast can cause errors to occur and is not a good method.)

I don’t really want to turn CharacterAutoLoads off because I would like to use the default spawn system. I did find a few possible solutions:

  • Use HumanoidDescription instead of replacing the players character. (I can do this because I’m using a r15 rig)
  • Clone the skin into StarterPlayer, name it StarterCharacter and calling LoadCharacter() instead of cloning the skin from server storage to the workspace.

I think HumanoidDiscerption is my best option but I would like your suggestions. Maybe you have a better idea?

Also the method I’m currently using has one other problem, I noticed the character’s animations aren’t replicating to the server. (Players can only see the animations on their own character, not anyone else’s.)
I have a default animation script and a Humanoid inside my character models.

caracterPic

I have know idea why it’s not replicated. (Maybe I need to set NetworkOwnership?)

All suggestions/ideas are appreciated! Thanks.

1 Like

I think the most efficient way would be the second way, you’ll just have to let go of that spawn system, lol.

1 Like

You thing turning CharacterAutoLoads off would be better than using HumanoidDescription?

This is not proper use of StarterCharacter and it’s a hacky character changing workaround that several developers have taken to use, for whatever reason. Don’t do this.

Pre-determined HumanoidDescriptions are the most appropriate option for you to use to be able to change appearance as seamlessly as possible. It also cuts out changing the character, which shouldn’t be done for a cosmetic system. You may also want to invest in a custom spawn system so that you’re able to respawn characters directly with their equipped character cosmetic using Player.LoadCharacterWithHumanoidDescription.

1 Like

Thanks for you suggestions. I will not use the StarterCharacter method and like you said I think HumanoidDescription is my best option. :+1: