Shirt and Pants default name should be named accordingly not "Clothing"


#1

As a Roblox developer, it is currently hard to detect a character’s shirt or pants instance without iterating through the children and checking the ClassName of the instances. It used to be Shirts were named “Shirt” and Pants were named “Pants” by default, but this changed recently for some reason.

This would improve my game / development experience because I could just use FindFirstChild, WaitForChild, etc. rather than having to iterate through to grab the shirts / pants of characters.

This is a minor issue, but I don’t see the point in the changing of their names. Maybe it was an accident?

image


#2

This is only the case when added through the Advanced Objects widget or Instance.new. When characters spawn in normally, shirt/pants names will be Shirt/Pants. If you’re creating them through Advanced Objects or Instance.new, you are in full control to rename them to Shirt/Pants.

You can use FindFirstChildOfClass or FindFirstChildWhichIsA to find the first object in the model that’s a shirt or pants instance.

Ideally we’d have WaitForChildOfClass and WaitForChildWhichIsA instead of waiting for shirts/pants by name, but for the case of player characters you don’t want to use WaitForChild on them. In certain cases with R15 characters, a character component will exist and then be replaced later, so the first instance returned by WaitForChild won’t be the final component.

Use Player.CharacterAppearanceLoaded:wait() instead of WaitForChild whenever you want to wait for something in a player’s character, and then you can use FindFirstChild/OfClass/WhichIsA to grab the components you want.


#3

Aah, yes. I forgot about those newer methods and good to know it doesn’t load them in as “Clothing”. I’ve just finished an avatar editor which is how I came across this issue. My apologies. :stuck_out_tongue: Thanks for the response!

Still, I feel like naming Shirts and Pants by default to just “Clothing” when using Instance.new() opposed to their ClassName is rather pointless and should be changed in the case that someone was relying on them being named Shirt and Pants without naming previously?


#4

Roblox could break someone’s game that expected the old name of shirts/pants. E.g.

2016 Code:

local mannequin = ...
local shirtToSell = ...

Instance.new("Shirt", mannequin)
mannequin.Clothing.ShirtTemplate = shirtToSell

Should be able to change name for Advanced Objects insertion, but that doesn’t seem very important right now.


#5

Has it really been named “Clothing” by default for a while now? I never before recall it being named Clothing when calling Instance.new() until just recently? If it has been, then that makes sense, and that was my concern if it was just recently changed.


#6

They’ve been named Clothing when inserted since they were introduced to the platform. The reason you’re only seeing this now is because you’ve begun to manually create them instead of using player avatars.


#7

Perhaps, I could’ve sworn I’ve manually instanced them in the past without having them named “Clothing” by default, but that’s interesting to know. Thanks! I’ll have to look back at some of my old code.