I’m looking to implement things like “Currently Wearing”, “Reset Avatar” and “Save Outfit to Roblox” as well as outfit inspection…
Is there a model for this? Or a plugin? I noticed a lot of games have same ways of doing the thing so I assumed that a model or a tutorial existed for something like this… they have emotes tab, all of that.
If anyone could help me or give me tips on where to start. I’d appreciate it.
This is pretty easy to do with HumanoidDescriptions. They provide a convient way to read and modify a players avatar in-game.
You can get a player’s accessories by first getting their description and then using HumanoidDescription:GetAcessories()
local Player = game:GetService("Players").LocalPlayer
local Character = Player.CharacterAppearanceLoaded:Wait()
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local CurrentHumanoidDescription = Humanoid:GetAppliedDescription()
print(CurrentHumanoidDescription:GetAccessories(true)) -- [[ {array of accessories}
Example : {
[1] = {
["AccessoryType"] = Hat,
["AssetId"] = 11216107590,
["IsLayered"] = false
};
...
}
]]
You can also make your own HumanoidDescription and apply them to a Humanoid.
local Player = game:GetService("Players").LocalPlayer
local Character = Player.CharacterAppearanceLoaded:Wait()
local Humanoid = Character:FindFirstChildWhichIsA("Humanoid")
local MyHumanoidDescription = Instance.new("HumanoidDescription")
MyHumanoidDescription.HatAccessory = "13175108336, 10790044226" --comma list can be any length
--must be applied on the server, send the description details over a remote and construct a new description there
Humanoid:ApplyDescription(MyHumanoidDescription) -- apply the description to the humanoid
And finally, you can prompt someone to save an avatar with AvatarEditorService using that same HumanoidDescription.
local AvatarEditorService = game:GetService("AvatarEditorService")
AvatarEditorService:PromptSaveAvatar(HumanoidDescription, RigType)
For “Currently Wearing,” I’d recommend using a viewport frame of the user’s avatar in-game. However, if you wanted to display their ACTUAL Roblox avatar, and not what they have on in-game, you could use the GetUserThumbnailAsync() method of the player in a LocalScript. (Or like Haystees said, use HumanoidDescriptions.)
As far as the “Reset Avatar” part - pretty sure you could just use Player:LoadCharacter() and that would work fine. Please note it clears the player’s Backpack and PlayerGui so make sure any UIs you make that you wouldn’t want to reset have ResetOnSpawn disabled.
Finally, as for “Save Outfit to Roblox,” do what Haystees said, again lol. You can also save the user’s avatar in-game. Use Datastores and make a table with all the items they have on for that.