Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i check if there is a certain object inside another one?

Asked by
Echtic 128
5 years ago

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

Log in to vote
1
Answered by
royaltoe 5144 Moderation Voter Community Moderator
5 years ago

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
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? royaltoe 5144 — 5y
Ad

Answer this question