You can write your topic however you want, but you need to answer these questions:
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.
What is the issue? Include screenshots / videos if possible!
I don’t know how to do it, I have tried many things.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried YT and Devforum
local resetButton = script.Parent
local Debounce = false
local function onButtonTouched(otherPart)
local character = game.Players:GetPlayerFromCharacter(otherPart.Parent)
if character and Debounce == false then
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
Debounce = true
-- Stores the original appearance
local originalAppearance = humanoid:GetAppliedDescription()
-- Remove all current clothing
for _, child in pairs(character:GetChildren()) do
if child:IsA("Clothing") then --child:IsA("Accessory") or child:IsA("Clothing")
child:Destroy()
end
end
-- Apply the original appearance
humanoid:ApplyDescription(originalAppearance)
wait(3)
Debounce = false
end
end
end
resetButton.Touched:Connect(onButtonTouched)
I tested the script and noticed that it does not work, I tried to modify it but could not. So I tried another much simpler way that should fit your needs
debounce = false
script.Parent.Touched:Connect(function(hit)
if debounce == false then
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local character = player.Character
local cframe = character.HumanoidRootPart.CFrame
player:LoadCharacter()
player.Character.HumanoidRootPart.CFrame = cframe
wait(3)
debounce = false
end
end)