Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

getting children only makes changes to some parts?

--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.

2 comments

0

all the parts are in one right? no parts inside parts etc?

0

right.

1 answer

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

2 comments

0

Forgot to add the end

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.