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 there is a certain object inside another one?

So for example i need to check if there's a certain value inside a part in order to fulfill the if condition inside a script. How do i do it?

1 answer

There's an :IsA() function for every object in Roblox.

Go through the children and check if the object you're looking at is the object type you're looking for

For example, if you're looking for all the parts inside of a model:


for _, child in ipairs(game.Workspace.Model:GetChildren()) do
        if(child:IsA("BasePart"))then
                print(child)
        end
end

1 comment

0

Hi, you've been online since I last posted, but you seem to not have the question answered. Do you still need this answer to be answered or does the code above work?

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