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

The first loop works fine but why isnt the second loop starting?

Asked by 5 years ago

So for some reason the 2nd loop will not begin after the first one does. I've tried several ways that I could think of to figure it out. The 2nd loop just doesnt seem to do anything when it should. Am I doing something wrong here?

for p = 1, 10, 0.1 do --First loop
    presents.TextTransparency = presents.TextTransparency - 0.1
    wait(0.1)
    if presents.TextTransparency <= 0.2 then
        tew.TextTransparency = tew.TextTransparency + 0.1
    end
end

wait(0.2)

for t = 1, 10, 0.1 do --Second Loop
    presents.TextTransparency = presents.TextTransparency + 0.1
    wait(0.1)
end
0
why not use the 'p' and  't'? awesomeipod 607 — 5y
0
Because it's the same exact numbers User#19524 175 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

The reason it looks like it did nothing is because the numbers in lines 1 and 11 are the exact same. Simply flip the numbers on one of them and problem solved. You should also use the p and t variables, as it makes the code cleaner to avoid TextTransparency = TextTransprency + 0.1

for p = 0, 1, 0.1 do --First loop, I changed it to 0, 1, .1
    presents.TextTransparency = p
    wait(0.1)
end

wait(0.2)

for t = 1, 0, -.1 do --Second Loop, made it go down by -.1
    presents.TextTransparency = t
    wait(0.1)
end

1
I keep letting these little things slip by, thank you! BlauKitten 88 — 5y
Ad

Answer this question