The title is confusing, but i want to know when for example, the amount of frames in a gui is the same as the amount of blocks in a folder. How do i achieve that? I hope you respond me
You can achieve this by using GetChildren by comparing the number of children in each gui.
Here is example of how you would compare the number of parts inside a model for 2 different models in workspace.
local a = game.Workspace.ModelA:GetChildren()
local b = game.Workspace.ModelB:GetChildren()
if #a == #b then
print("They have the same number of parts!")
else
print("They don't have the same number of parts!")
end
And i have a question, because right now i’m making someting which is cloning frames with the same amount of a pets folder, which it’s not required this script. Well, i want to identify when the script of cloning stop by using this, i mean: identify when there’s the same amount of frames as pets, and when that happens, will do a function, how i do that? Because the script you shared, is only getting childrens once.
There are many ways to do this, but to my understanding of what you are trying to do is run a function when any frames or pets are added or removed, you would need to use ChildAdded and ChildRemoved.
Here is an example of connecting this Instance to a function.
function check()
local a = game.Workspace.ModelA:GetChildren()
local b = game.Workspace.ModelB:GetChildren()
if #a == #b then
print("They have the same number of parts!")
else
print("They don't have the same number of parts!")
end
end
game.Workspace.ModelA.ChildAdded:Connect(check)
game.Workspace.ModelA.ChildRemoved:Connect(check)
game.Workspace.ModelB.ChildAdded:Connect(check)
game.Workspace.ModelB.ChildRemoved:Connect(check)