So I'm working on a GUI and I'm working on a little cutscene in it. I'm making textlabels change transparency within a loop. I want to trigger another loop without stopping the present one and/or change two different variables in the same loop where one counts up and the other counts down.
This is what I have now.
function onPlayerAdded() local intro = menus.Intro intro.Visible = true local tew = intro["TEW"] local presents = intro.Presents intro.BackgroundTransparency = 0 for i = 1, 0, -0.1 do --First loop tew.TextTransparency = i wait(0.1) end for p = 1, 0, -0.1 do --Second loop presents.TextTransparency = p wait(0.1) end end Players.PlayerAdded:Connect(onPlayerAdded)
How would I change two variables in the same loop where one goes up and the other goes down? This was my attempts at figuring it out.
--Attempt 1 for p = 1, 0, -0.1 do --Second loop presents.TextTransparency = p wait(0.1) tew.TextTransparency = -p end --Attemp2 while tew.TextTransparency ~= 0 do tew.TextTransparency = tew.TextTransparency - 0.1 wait(0.1) end if tew.TextTransparency == 0 then while presents.TextTransparency ~= 0 do presents.TextTransparency = presents.TextTransparency - 0.1 tew.TextTransparency = tew.TextTransparency - 0.1 wait(0.1) end end
I'm out of ideas from here. What should I do?
This code will work already, but if you realise your tew doesnt change, its because transparency in roblox goes from 0 to 1 only
tew transparency will start from 0 and become invisible gradually and vice versa for presents
for p = 1,10 do --Second loop presents.TextTransparency = presents.TexTransparency - 0.1 wait(0.1) tew.TextTransparency =tew.TextTransparency + 0.1 wait(0.1) end
You do not have to use p as a variable for the transparency, you can define your own variables or just do what i do in the code