How can I save and load accessories?

In my game I want to add an ability where u can disguise as other players and your disguise will save across servers. The only issue is how do I save and load the accessories of the disguises? I should probably mention this game has character customization so I cannot just load a players avatar onto another.

7 Likes

You said player outfits? well the simplest thing to do is use Humanoid Description.

2 Likes

You cannot save humanoid descriptions in a data store.

1 Like

Well u can save the players id…

2 Likes

“I should probably mention this game has character customization so I cannot just load a players avatar onto another.”

2 Likes

can’t you just delete the accessories?

1 Like

What do you mean? Its customizable characters meaning loading someones avatar from the site wouldnt be the same. Also what if they change accessories? I also want this to work with NPCs so even if it did work it wouldn’t work for everything.

I know for things like shirt IDs, skin color, etc I can just save the values but accessories is where it gets tricky.

1 Like

Would it be possible to save the type of accessory e.g hat, hair, face and then recreate it using the same type of attachment and I save the meshID and texture id and set them on a special mesh?

1 Like

A simple way would be :
1.Have a folder of all availble hats in your game, and put it in ServerStorage.
2.Inside each hat have an Equipped [boolvalue] - if you want to save and load them on the players too.
3.When the player equips/unequip a hat, change that hat Equipped value accordingly
4.When the player leaves, save all the hats he owns as strings and save the Equipped value aswell.
5.When the player rejoins, check through that folder you put in serverstorage, what hats he had before, and then clone them back into his inventory - and if he wore any hats, detect it using the Equipped value, etc

[An alternative way if you dont want to have the equipped value, is to when a player equips a hat, add it to a dictionary that will handle all in-game players hats, and when the player unequips the hat, remove the hat from there, and then you could simply just save that table into the datastore and when the player rejoins, check for all hats there and find their matching accessories in the hats folder]

If your hats are only from the roblox catalog, you could also do it using JSON [HTTP Service]

2 Likes

The character customization keeps your default avatars hair and face accessories. Things like shirts, face, skin color, etc are effected by customization. Since it uses the default hairs you spawn with there is no way to keep them in server storage. I should have specified that.