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

How do I check if something's class is from a character without so much "if not"?

(Sorry for my English, I'm Turkish) For example I want to check if something's class is "Pants" or "Shirt", my code for now:

for i,v in ipairs(a char:GetChildren()) do
    if not v:IsA("Part") and not v:IsA("Accessory") and not v:IsA("Accoutrement") and not v:IsA("CharacterMesh") then
 --do things
 end
end

1 answer

✓ Accepted answer

You want to check if something is pants or shirt?

Simple answer for that

something:IsA("Pants")
something:IsA("Shirt")

There is also a thing called shirt graphic which are decals on your shirt, you check it the same way

something:IsA("ShirtGraphic")

But instead of all this, all of the clothing is in one class called Clothing

something:IsA("Clothing") -- Shirts, Pants, ShirtGraphic

1 comment

0

Thank you!

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