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

Help with text taking forever to fade out?

Asked by 8 years ago
playbutton.MouseButton1Down:connect(function()
    for _, v in pairs(introframe:GetChildren()) do
        v:TweenPosition(UDim2.new(v.Position.X.Scale,v.Position.X.Offset + 40,v.Position.Y.Scale,v.Position.Y.Offset), "Out", "Quad", 1, true)
        for i = 0, 1, 0.1 do
            v.TextTransparency = i
            v.Shadow.TextTransparency = i
            wait()      
        end
    end
end)

I have 4 TextLabels inside the IntroFrame. It only does one at a time, and it takes a while for them to happen. How can I speed this is up, and make them all fade out at the same time?

0
Your using an in pairs loop so all the stuff in introFrame will fade but one at a time because its a loop and it does it one at a time, if you want to do it each then you need to mabye use a coroutine or a different script to do it at once. LifeInDevelopment 364 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

That's because you fade each UI serperately. Instead, you'd want to do this:



playbutton.MouseButton1Down:connect(function() for _, v in pairs(introframe:GetChildren()) do v:TweenPosition(UDim2.new(v.Position.X.Scale,v.Position.X.Offset + 40,v.Position.Y.Scale,v.Position.Y.Offset), "Out", "Quad", 1, true) end for i = 0, 1, 0.1 do for _, v in pairs(introframe:GetChildren()) do v.TextTransparency = i v.Shadow.TextTransparency = i end wait() end end)

And regards the comment on the question, you definitely don't want to use serperate threads and scripts. Will make it much harder to manage.

0
I don't see much of a difference, this may work but can you explain it to me? LifeInDevelopment 364 — 8y
Ad

Answer this question