I'm trying to get the children of two models into 1 variable, I tried this, but won't work. Any help?
reds1 = elfins.ElfinFlower1.Lights.Red1:getChildren() and elfins.ElfinFlower2.Lights.Red1:getChildren()
I'm trying to get the children of two models into 1 variable, I tried this, but won't work. Any help?
reds1 = elfins.ElfinFlower1.Lights.Red1:getChildren() and elfins.ElfinFlower2.Lights.Red1:getChildren()
You can assign each child to a single array with this script
local flowerCount = 2 -- If you have more flowers, change this.
local reds1 = {}
for i = 1, flowerCount do
for _,v in pairs(elfins["ElfinFlower"..tostring(i)].Lights.Red1:GetChildren()) do
table.insert(reds1, v)
end
end
Or, after reading your comment on Spongocardo's answer, you can
--Change:
table.insert(reds1, v)
--To:
v.SurfaceGui.Enabled = true
You can't use "and" when assigning a variable, you have to assign separate variables to each value.
red1_1 = elfins.ElfinFlower1.Lights.Red1:GetChildren()
red1_2 = elfins.ElfinFlower2.Lights.Red1:GetChildren()
What about this, how can I get both variables in the same loop? for _,v in ipairs (reds1) do v.SurfaceGui.Enabled = true end
You could try doing what Necrorave said. That could work out for you.
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
You cannot assign two things to one variable. You can create an array though and assign each element within that array.