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

How do I check if something is missing from a model?

I have a model which contains

1 comment

0

Can you give us a little more information about what you're trying to do?

1 answer

Using FindFirstChild, you can check whether something with a specific name is inside the model.

local name = "EnterNameHere"
if model:FindFirstChild(name,true) then
	print(name .. " is inside the model.")
else
	print(name .. " is not inside the model")
end

The second argument is a bool value that determines whether only the first children of the model are checked when false, or if all descendants of the model are checked when true.

If you want to search by class, you can use FindFirstChildOfClass.

Otherwise, if you have the instance and you want to check if it’s inside, you can use

if thing:IsDescendantOf(model) then

to check.

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