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

i cant make my script run forever . How do i make a script run forever?

Asked by
truted1 21
8 years ago
Edited 8 years ago

Im trying to make this script fun forever. so far this is what i tried and i doesn't work

while true do

wait(0.1) script.Parent.Transparency = 0.9 wait(0.1) script.Parent.Transparency = 0.8 wait(0.1) script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.6 wait(0.1) script.Parent.Transparency = 0.5 wait(0.1) script.Parent.Transparency = 0.4 wait(0.1) script.Parent.Transparency = 0.3 wait(0.1) script.Parent.Transparency = 0.2 wait(0.1) script.Parent.Transparency = 0.1 wait(0.1) script.Parent.Transparency = 1

until false

0
You are confusing a while do loop an a do until loop. replace the 'until false' with end User#5423 17 — 8y
0
If SuperAndresZ_YT's answer was good enough then please accept it. You and him/her/it both will get a point for it. AZDev 590 — 8y
0
If SuperAndresZ_YT's answer was good enough then please accept it. You and him/her/it both will get a point for it. AZDev 590 — 8y

4 answers

Log in to vote
1
Answered by
FiredDusk 1466 Moderation Voter
8 years ago

This should work, I hope.

while true do
    for i = 1, 0, -.1 do
        wait(0.1)
        script.Parent.Transparency  = i --'i' is a changing number value
    end

    for i = 0, .1, .1 do
        wait(0.1)
        script.Parent.Transparency  = i
    end
end
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

You're trying to 'disappear' a block, right? The 'Until False' that you're using it's incorrect, it'll never go false. Try this instead:

while true do
    for i = 1, 10 do
        wait(0.1)
        script.Parent.Transparency = script.Parent.Transparency - 0.1
    end
end

...It should work. ;)

Log in to vote
0
Answered by 8 years ago

If you want an eisier to understand kinda one then try this

while true do
    if <var>  ==  false then
        wait(0.1) 
        script.Parent.Transparency = 0.9 wait(0.1) script.Parent.Transparency = 0.8 
        wait(0.1)   
        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.6
        wait(0.1) 
        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.4 
        wait(0.1) 
        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.2
        wait(0.1) 
        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0   
    else
        return end
    end
end             

idk if this is what u want but ok...

Log in to vote
0
Answered by
AZDev 590 Moderation Voter
8 years ago

If you want the loop to stop when the part is completely invisible then you can make a simple change to SuperAndresZ_YT's loop. Just remove the while loop and the for loop will do it's job and stop after 10 loops.

For example:

for i = 1, 10 do
     wait(0.1)
     script.Parent.Transparency = script.Parent.Transparency - 0.1
    end
end

wait(1)
script.Parent.Transparency = 1

Another way to do the same thing:

while script.Parent.Transparency > 1 do
    wait()
    script.Parent.Transparency = script.Parent.Transparency - 0.1
end

wait(1)
script.Parent.Transparency = 1
0
Just reviewing some of my old answers, at this point I can't believe I would post this. It's wrong. AZDev 590 — 8y

Answer this question