How to make a reset clothes button? (Without killing their avatar)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I have multiple buttons that players can step on which changes their clothes and I want to make a button that if a player touches, it then resets their clothes to what their avatar was wearing.
  2. What is the issue? Include screenshots / videos if possible!
    I don’t know how to do it, I have tried many things.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I have tried YT and Devforum
2 Likes

server script under whatever you want

local originalshirt = 0
local originalpants = 0

local ps = game:GetService("Players")
ps.PlayerAdded:Connect(function(player))
local attachclothes = player.CharacterLoaded:Connect(function()
originalshirt = player.Character:FindFirstChild("Shirt").AssetID -- forgot what its called to get the id
originalpants = player.Character:FindFirstChild("Pants").AssetID -- forgot what its called to get the id
end)
-- disconnect the function i dont remember if the player has an event for leaving but you can figure it out yourself
end)
1 Like

This isn’t what i need, i want it to get the pants and shirt from the players original avatar and then apply it to the character

it’s a start to your solution, it gets the players original clothes, you can then do whatever you want with this information. giving you the straight answer is no way to learn

1 Like

You can do a folder in ServerStorage or whatever, and if a player joins and character is loaded, you can clone the HumanoidDescription from the Humanoid and name it to the name of the Player. If you want to take everything, just do ApplyDescription(), if not, copy the ids of it by

game:GetService("ServerStorage").OriginalClothes:FindFirstChild(Player.Name)

I’d use :GetHumanoidDescriptionFromUserId(), here’s how you would achive what you wanted.

(Edit as you will, might not work perfectly with your game)

local Players = game:GetService("Players")
local Part = "Path"

Part.Touched:Connect(function(Hit) -- Touched connection to detect whenever a character touches the part
    local Character = Hit.Parent.Parent

    local Humanoid = Character:FindFirstChild("Humanoid")
    assert(Humanoid, "Couldn't find Humanoid")

    local Player = Players:GetPlayerFromCharacter(Character)

    local Description = Players:GetHumanoidDescriptionFromUserId(Player.UserId) -- Get original HumanoidDescription
    local CharacterDescription = Humanoid:GetAppliedDescription() -- Get the applied description from Humanoid
    if Description and CharacterDescription then -- Applies the original clothes to the current HumanoidDescription
        CharacterDescription.Shirt = Description.Shirt
        CharacterDescription.Pants = Description.Pants

        Humanoid:ApplyDescription(CharacterDescription)
    end
end)

it doesn’t even give me the pants and shirts ids

it doesn’t work, my character stays the same

i wrote in there notes of how to continue it.

send the script

i did it correct with no errors and i tried to print out the ids and it gave me an error

maybe send me the error???

its ok, ill try and figure it out

did you change the part path.

also maybe if you want help you should provide more information? like ERROR LOGS and OUTPUTS?

1 Like

I changed it to what it needs to be

Did you find a solution for it yet?

you cant just ask people for scripts, you need to give some code to work with from the beginning

no, i havent unfortunately :((((((

I think all you gotta do is just copy the ids of the shirts when they join and store them in a folder. When the player touches the part their clothing id is changed to the ids stored in the folder

i tried that, but it doesn’t work. For it to work, can you give me an example script of: how to wait for the players avatar to properly load?

I would assume its like making a leaderstats like in a simulator game.

game.Players.PlayerAdded:Connect(function(plr) -- Player joined
	plr.CharacterAdded:Connect(function(char) -- get character
		local folder = Instance.new("Folder", plr) -- make folder
		folder.Name = "OriginalClothes" -- name folder
		
		char:WaitForChild("Pants"):Clone().Parent = folder --clone pants to folder
		char:WaitForChild("Shirt"):Clone().Parent = folder -- clone shirt to folder
	end)
end)

This script clones the clothes of the player when they first joined. So in the script when they touch the part just change the clothes they have to the one in the folder.