Hello,
im trying to give the player his orginal clothing and accessoires back, so I found this script but it isnt working sadly. And does HumanoidDescription even work with clothing? There are no errors so i dont really know whats wrong
local Players = game:GetService("Players")
local Part = script.Parent
Part.Touched:Connect(function(Basepart)
local Character = Basepart.Parent
if Character:FindFirstChildOfClass("Humanoid") then
local Player = Players:GetPlayerFromCharacter(Character)
local Humanoid = Character:FindFirstChildOfClass("Humanoid")
if Player then
local HumanoidDescription = Players:GetHumanoidDescriptionFromUserId(Player.UserId)
if HumanoidDescription then
Humanoid:ApplyDescription(HumanoidDescription)
end
end
end
end)
The HumanoidDescription object is only used to customize a player’s appearance, it does not store the player’s original clothing or accessories. Therefore, you cannot use HumanoidDescription to restore a player’s original appearance.
Also, the Touched event is not guaranteed to be fired when a player’s character enters a part’s collision bounds. Instead, you can use the CharacterAdded event to detect when a player’s character spawns in the game, and then restore their appearance at that time.
Something like this might work.
You’d have to change it for a touch part because this is on join for whatever reason
local Players = game:GetService("Players")
local function restoreAppearance(player)
local humanoid = player.Character:WaitForChild("Humanoid")
local currentDescription = humanoid:GetAppliedDescription()
for _, item in ipairs(currentDescription.Clothing) do
humanoid:RemoveClothing(item)
end
for _, item in ipairs(currentDescription.BodyParts) do
humanoid:RemoveAccessory(item)
end
for _, item in ipairs(currentDescription.IncludedAssets) do
humanoid:RemoveAccessory(item)
end
local originalDescription = Players:GetHumanoidDescriptionFromUserId(player.UserId)
for _, item in ipairs(originalDescription.Clothing) do
humanoid:Wear(item)
end
for _, item in ipairs(originalDescription.BodyParts) do
humanoid:EquipAccessory(item)
end
for _, item in ipairs(originalDescription.IncludedAssets) do
humanoid:EquipAccessory(item)
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
restoreAppearance(player)
end)
end)