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

How to check for shirt before changing shirtid?

When people don't wear any shirts the script crashes. How can I make it check for shirts 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

1 comment

0

Thank you!

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