Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Shirt + pants not deleting when they should?

First of all, I'm not on oder. Secondly, this script should've deleted the player's shirt and pants when they join (so that the body colors can be re-colored) but when I test this without wearing any clothing, it doesn't work.

if player.Character.className == "Shirt" == nil then
		print("There is no need to delete the shirt")
	else
		player.Character.Shirt:Destroy()
	end
	if player.Character.className == "Pants" == nil then
		print("There is no need to delete the pants")
	else
		player.Character.Shirt:Destroy()
	end

If anyone could tell why, that'd be great!

1 answer

I'm pretty sure this works.

for index, child in pairs(player.Character:GetChildren()) do
	if child:IsA("Shirt") or child:IsA("Pants") then
		child:Destroy()
	end
end

1 comment

0

It didn't really work. What I was saying in my post was that if the player isn't wearing any clothing (e.g. using noob colors [yellow arms + head, blue torso, green legs, no shirt, no pants]) the script completely breaks.

This discussion is preserved as it was. New answers, comments, and votes are closed.