As the player spawns, I want to remove the majority of their clothing. It does go through the first few things but once it gets to line 27-37, it doesn't work. This is for the shirt, pants, and shirt graphic (t-shirt).
Here's the code.
wait(1)
local d = script.Parent.Parent.Character:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove()
end
end
local humanoid = script.Parent.Parent.Character:FindFirstChild("Humanoid")
if humanoid then
for i,v in pairs (script.Parent.Parent.Character:GetChildren()) do
if v:IsA("CharacterMesh") then
v:Destroy()
wait()
print(v.Name.." has been removed from "..script.Parent.Parent.Character.Name)
end
end
end
script.Parent.Parent.Character.Head.BrickColor = BrickColor.new("Light orange")
script.Parent.Parent.Character.Torso.BrickColor = BrickColor.new("Institutional white")
script.Parent.Parent.Character["Left Arm"].BrickColor = BrickColor.new("Light orange")
script.Parent.Parent.Character["Right Arm"].BrickColor = BrickColor.new("Light orange")
script.Parent.Parent.Character["Left Leg"].BrickColor = BrickColor.new("Dark stone grey")
script.Parent.Parent.Character["Right Leg"].BrickColor = BrickColor.new("Dark stone grey")
function kill(nam, parent) if parent:FindFirstChild(nam) then
parent[nam]:Destroy()
end end
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function()
local Character=script.Parent.Parent
kill("roblox", Character.Torso)
kill("Shirt", Character)
kill("Pants", Character)
end)
end)

1 comment
In line 11, you could also add an if statement: If v:IsA("ShirtGraphics") then v:Destroy() end same for Pants and Shirt. I haven't tried it, that's why i'm not posting it as an answer.