Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does this loop do this ?

What i want it to do is just go from 0 to 0.30 and keep repeating but they just go to -1 then back to 1 why does this happen ?

glow = script.Parent
num = 30
while true do
    for i = 1, num do
        glow.Transparency = 0+i/num/1
        wait()
    end
    for i = 1, num do
        glow.Transparency = 0.30 - i/num/1
        wait()
    end
end

1 answer

The answer is simple. You just got some math incorrect:

glow = script.Parent
num = 30
while true do
    for i = 1, num do
        glow.Transparency = 1/(num/i)
        wait()
    end
    for i = 1, num do
        glow.Transparency = 1/(num/i)
        wait()
    end
end

You should really improve your math skills. It would help a lot.

1 comment

0

it goes from 0 to 1 then instaly goes back to 0 and i want it to go from 0 to 0.30 then from 0.30 to 0...

This discussion is preserved as it was. New answers, comments, and votes are closed.