When people don't wear any shirts the script crashes. How can I make it check for shirts before changing shirtid?
✓ ANSWER ACCEPTED
How to check for shirt before changing shirtid?
1 answer
✓ Accepted answer
Use the FindFirstChild() method. What this method does is search for the child defined in the parentheses. If the child exists, it returns that child. If it doesn't, it returns nil. FindFirstChild() must be used with an if statement in order to be useful.
if character:FindFirstChild("Shirt") then
print("The character has a shirt")
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you!