This script is supposed to allow a player to try on clothing before they buy it, but the only issue is that the clothing stays on them. I would like to have this script remove the player's pants, put on the pants that will be sold, wait for 5 seconds, then remove those pants and restore the original pants. I believe it sounds a lot more complicated than it should be. Any ideas?
local cd = script.Parent.ClickDetector
local pants = script.Parent.Parent.Parent.Char.Pants
cd.MouseClick:connect(function(player)
if player.Character ~= nil then
if player.Character:FindFirstChild("Pants") then
player.Character["Pants"]:remove()
pants:Clone().Parent = player.Character
else
pants:Clone().Parent = player.Character
end
end
end)

7 comments
Line 7 should be player.Character.Pants:Remove()
Thats deprecated tho you should use :Destroy() instead
Id instead tho set the parent of the pants to nil and then later set the parent of the pants to the player's character
I don't know how to do that, but I will try sorry just starting to learn how to script.
alright so here's what I've got so far:
I wasn't able to paste it into the post section so I had to put it as an answer
hey since you helped me, if you just copy and paste what I have down below, I can accept your answer so that you can get some credit. And if there is anything that you would change please feel free to let me know!