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.
I have know idea why it’s not replicated. (Maybe I need to set NetworkOwnership?)
All suggestions/ideas are appreciated! Thanks.