How do I change the transparency of all children in a model all at once, instead of one by one?

Well what else do you need to do?

if part.Transparency == 1 --[[And whatever else you need to check]] then continue end

should work just fine if placed in the beginning of your loop.

Use ~= instead of == to ignore Transparent parents

image

I did it, but the whole thing is invisible now and won’t show up.

Now you are checking if the HumanoidRootPart is invisible every loop. You want to check if the part(v) is already transparent, right?

image

This is the error I got when I replaced HRP with v

Of course check if v is a basepart before this.

image

The dummy is just invisible and won’t even show now

Well I just changed the humanoid root part to a very small size, so I guess that works…?

You wanted to ignore invisible parts right?

If you only wanted to ignore HumanoidRootPart just check if v == HumanoidRootPart

I was today years old when I found out continue existed on Roblox Lua.

Anyways, it should have worked? You just iterate and ignore any invisible parts I am not sure what you did wrong.

1 Like

I also find coroutine.wrap(function() better in my opinion because of this:

This is harder to remember

local t = coroutine.create(function()
    
end)

coroutine.resume(t)

This is much easier to remember

coroutine.wrap(function()

end)()

In my opinion coroutine.wrap() is easier than coroutine.create() because coroutine.create() requires you to make it in a variable t (In my case, t would be that variable), then you have to do coroutine.resume() on it, while coroutine.wrap() only requires you to do this:

coroutine.wrap(function()

end)()

So much easier right?

Yep, its much easier, but from my experience with coroutines, using coroutine.wrap() causes the function to only run once when called. Calling the function again will yield the error that the coroutine is dead. So coroutine.create followed by coroutine.resume allows the coroutine to run again like a normal function. Of course, if you only want the coroutine to run once, this is not of concern.

for i,v in pairs(Mystand:GetDescendants()) do
      if v:IsA(“BasePart”) then
            repeat v.Transparency =  v.Transparency - 0.1 wait(0.1) -- Decreasing the transparency of the part until its 1
            until v.Transparency == 1
            wait()
      end
end

Try this script?