In my game, we will have costumes for the players when they roleplay as certain characters. When the roleplay is over, we want to revert back to their original outfit. Is there a service for us to get the default outfit players have?
you can save the default clothing the player is wearing, then reapply it once its needed, but if anyone else knows of a better way to do, then let us know
1 Like
GetHumanoidDescriptionFromUserId. You can get all players then call this function provided they have a character and a humanoid. Call ApplyDescription on whatever gets returned. Make sure that GetHumanoidDescriptionFromUserId is wrapped in a pcall since it’s internally a web call.
local function resetAllAppearances()
for _, player in ipairs(Players:GetPlayers()) do
local character = player.Character
local humanoid = if character then character:FindFirstChildOfClass("Humanoid") else nil
-- Skip handling this player if they don't have a character or humanoid
if not character or not humanoid then continue end
local success, description = pcall(Players.GetHumanoidDescriptionFromUserId, Players, player.UserId)
if success and description then
humanoid:ApplyDescription(description)
end
end
end
This is assuming your roleplay outfits are using regular avatar assets and not hand welding anything to the player. In the case you aren’t using standard CharacterAppearance assets you will need to manually clear their appearance first before applying their old outfits.
2 Likes
for _, player in ipairs(game.Players:GetPlayers()) do
player:LoadCharacter()
end