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.

01while true do
02    for i = 1, 0, -.1 do
03        wait(0.1)
04        script.Parent.Transparency  = i --'i' is a changing number value
05    end
06 
07    for i = 0, .1, .1 do
08        wait(0.1)
09        script.Parent.Transparency  = i
10    end
11end
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:

1while true do
2    for i = 1, 10 do
3        wait(0.1)
4        script.Parent.Transparency = script.Parent.Transparency - 0.1
5    end
6end

...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

01while true do
02    if <var>  ==  false then
03        wait(0.1)
04        script.Parent.Transparency = 0.9 wait(0.1) script.Parent.Transparency = 0.8
05        wait(0.1)  
06        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.6
07        wait(0.1)
08        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.4
09        wait(0.1)
10        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0.2
11        wait(0.1)
12        script.Parent.Transparency = 0.7 wait(0.1) script.Parent.Transparency = 0  
13    else
14        return end
15    end
16end            

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:

1for i = 1, 10 do
2     wait(0.1)
3     script.Parent.Transparency = script.Parent.Transparency - 0.1
4    end
5end
6 
7wait(1)
8script.Parent.Transparency = 1

Another way to do the same thing:

1while script.Parent.Transparency > 1 do
2    wait()
3    script.Parent.Transparency = script.Parent.Transparency - 0.1
4end
5 
6wait(1)
7script.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