Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

getting children only makes changes to some parts?

Asked by 5 years ago
--flora manager--

local stage = 1 --growth stage--

while true do
    wait(4)
    if script.Parent.GrowthNum.Value >= 25 and stage == 1 then
        stage = 2
        local prevchildren = script.Parent.Parent.Parent.Stage1:GetChildren()
        local nextchildren = script.Parent.Parent.Parent.Stage2:GetChildren()
        for p = 1, #prevchildren do
            if prevchildren[p]:IsA("Part") then
            prevchildren[p].Transparency = 1
            prevchildren[p].CanCollide = false
            end
        end
        for n = 1, #nextchildren do
            if nextchildren[n]:IsA("Part") then
                nextchildren[n].Transparency = 0
                nextchildren[n].CanCollide = true
            end
        end

    elseif script.Parent.GrowthNum.Value < 25 and stage == 1 then
        script.Parent.GrowthNum.Value = script.Parent.GrowthNum.Value + 5
    end

    end

no error comes up but when both for loops run, only some parts get changed. the rest are untouched. this is not desired as all parts involved should be changed.

0
all the parts are in one right? no parts inside parts etc? Arkrei 389 — 5y
0
right. mantorok4866 201 — 5y

1 answer

Log in to vote
-2
Answered by 5 years ago

Getting Children does not make changes to any parts, unless you change the properties.

For example,

for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA("Part") then


v.Color = Color3fromRGB(255,255,255)

end
0
Forgot to add the end SupaTheNoobCatcher 12 — 5y
0
but isnt that what its trying to do? such as at line 13 and 14 were transparency and cancollide is changed. and it is making changes with the problem being that its only changing some parts. mantorok4866 201 — 5y
Ad

Answer this question