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

Why is this loop counting down instead of counting up?

Asked by 6 years ago

I have a text label that I want to slowly appear but instead its just there and fades away.

By my understanding this should count up. No where in the script does tew called except for in this loop. So I dont get why its fading instead of appearing. What could be causing this?

for t = 0, 1, 0.1 do
    tew.TextTransparency = t
    wait(0.1)
end

2 answers

Log in to vote
1
Answered by
mattscy 3725 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Simple problem: the higher the transparency is (aka the closer it is to 1), the more transparent it makes the part. So, setting the transparency to 1 means that it's 100% transparent (completely invisible), while setting the transparency to 0 means that it's 0% transparent, (completely opaque). So, to fix this, you can start the loop at 1 and end at 0, decreasing by 0.1 every iteration:

for t = 1,0,-0.1 do
    script.Parent.Transparency = t
    wait()
end
0
u helped me breathe User#19524 175 — 6y
0
i just realized I was thinking about it backwards. Thank you very much. BlauKitten 88 — 6y
Ad
Log in to vote
-2
Answered by 6 years ago

It is because you are doing it wrong

0
How should I be doing it? BlauKitten 88 — 6y
0
I do not know you should be doing it correctly maybe the numbers things are wrong I am not sure WilliamEdwin380 -71 — 6y
0
you could have made this a comment.. TrixitesWasTaken 13 — 6y
0
What do you mean! WilliamEdwin380 -71 — 6y

Answer this question