THIS IS ANSWERED I dont know how to mark it as answered so yeah
So everything is in the model 'Stuff' and in that is 2 objects named 'Test' and a script in the model with them. How do I use the script to select both of the objects and edit BOTH of them.
Go to "sync.in/roblox" and I'll show my Tree (or what it looks like) I dont even have a script because I dont know how to make it, so that's all I can show you
I tried using FindFirstChild, but, as that is written, it only edits the 'First' Child it finds that matches its search. Please help. URGENT. Thanks! Please keep simple, I don't want to use a for script, that will be buggy with what I'm working on
I used to be able to do this, sorry for the stupid question.
The straightforward way is to find all children using :GetChildren()
, and then ignore those without the the name you're looking for:
for _, child in pairs(parent:GetChildren()) do if child.Name == "WantedName" then -- Do whatever to `child` end end
A less elegant approach would be to continually rename the objects:
local thing = parent:FindFirstChild("WantedName") while thing do -- Do whatever to `thing` thing.Name = "UsedUpName" thing = parent:FindFirstChild("WantedName") end
This is obviously less desirable since it changes all of the names of the children. Ideally, you would have an equivalent loop that puts them back. It makes more sense to just go over all of the children in the simple for
loop.