Hello I would like to know how to change the child of findfirstchild, like just say inside a folder I have 3 Values named “Hi” each and I add a value in each of them called taken. and It will do the findfirstchild and check, if the value is taken then it will run findfirstchild until it find the one that isnt taken.
Just use the ‘found child’ and run findfirstchild on that. ??
Since you have more than one child with the same name you’ll need to use getchildren instead though. then cycle through those with findfirstchild till you find the one you want to use
for _, pet3 in ipairs(script.Parent.Container) do
if pet3:FindFirstChild(split3[2]) then
pet3.EquipBestTaken.Value = true
if pet3.EquipBestTaken.Value == true then --check
print(pet3.Name.." IS TAKEN")
end
print(pet3.Name)
pet3.Equipped.Value = true
replicatedStorage.EggHatchingRemotes.EquipPet:InvokeServer(split3[2])
pet3.Checkmark.Visible = true
end
end
I’m a little confused by your request, but this should help you:
local found = nil
for _,child in pairs(script.Parent.Container:GetChildren()) do
if not child.taken.Value then
found = child
break
end
end
print(found:GetFullName())
-- ...