How would I find out if a Model has ANY children at all without checking for a specific name?
For example,
if game.Workspace:FindFirstChild("Storage") has children then
print("Storage has kids!")
else
print("Storage ain't got no kids.")
end
How would I find out if a Model has ANY children at all without checking for a specific name?
For example,
if game.Workspace:FindFirstChild("Storage") has children then
print("Storage has kids!")
else
print("Storage ain't got no kids.")
end
if #instance:GetChildren() > 0 then
-- Do something
end
EDIT:
For clarity, the # operator returns the number of instances in a numerically indexed table. The :GetChildren() function retrieves a table of all children inside an instance.
if #workspace:FindFirstChild("Storage") :GetChildren() > 0 then
return true
else
return false
end
object:ClearChildren() ight work for something
Is that necessary? That can boil down to
return #workspace.Storage:GetChildren() > 0
That removes all children of the instance and you got the name of the function wrong, it’s :ClearAllChildren()
Awesome! Thank you everybody!
well as this would use a much more complex script as if it can clear children
What are you trying to say exactly, I couldn’t understand anything from that sentence no offense.
nvm
characterrrrrrrrrrrrrrrrrrrrrs