I am trying to make an if statement, where the argument is that a part has no children Ex:
if (part has no children) then (insert code here)
How would I attempt this?
You would get a table of the children of that part and see if there are 0 values in that table, so then you can execute your code
local Part = game.Workspace.Part -- Target Part local Child = Part:GetChildren() --Storing Table into var if #Child == 0 then --Execute code end
This should work (I haven't tested it, though)
`````` for _, v in ipairs (part:GetChildren()) do if v then print("There is a child!") if not v then print("There is no child") end ```````````