-- thing -- child
I'm not looking for a specific child I just want to check if a part even has one. So I want a true or false output
Ideas?
roblox objects have a method called GetChildren()
which basically returns a table with all the direct children of the object. Using table manipulation, we can tell if that table has 1 or more parts by using the #
operator. The #
operator basically returns the amount of elements in a table or the amount of characters in a string. So for example:
local Test = {"Apple", "Banana", "Carrot"} print(#Test) --This prints 3
If you want to use this for what you want, basically just use the operator on the GetChildren()
table, like so:
local Boolean = #Model:GetChildren() > 0 print(Boolean) --prints true if the model has 1 or more children, else it prints false
Hope this helped!