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

error trying to change transparency with a GetChildren() value?

wait(2)

local children = script.Parent:GetChildren()

for i = 1, #children do
allstuff1 = children[i]
	allstuff1.Transparency = 0.7
end
wait(0.1)
for i = 1, #children do
allstuff1 = children[i]
	allstuff1.Transparency = 0.6
end
wait(0.1)
for i = 1, #children do
allstuff1 = children[i]
	allstuff1.Transparency = 0.4
end
wait(0.1)
for i = 1, #children do
allstuff1 = children[i]
	allstuff1.Transparency = 0.1
end

im trying to change a group of parts transparency in stages, Im getting an error at line 7 saying: (transparency is not a valid member of script)

2 comments

0

Have you tried checking whether it was a part or not via IsA? if Obj:IsA('BasePart') then

0

I think I see the problem, I was getting all the children from the model including the script itself, just another thing right under my nose :/

1 answer

You need to add a check.

for i = 1, #children do
if not i:IsA("Part") then return end--It checks if the object is a part and if not then it stops the current loop
allstuff1 = children[i]
allstuff1.Transparency = 0.7
end

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