Hey!
I'm fairly new to scripting and I'm having trouble how to figure out how to loop some code until a condition is met or repeat some code until a condition is met.
(any help would be greatly appreciated)
Here is my current script:
01 | local value = game.Workspace.Value |
02 |
03 | if value.Value > 20 then |
04 |
05 | while true do |
06 | wait( 0.01 ) |
07 | script.Parent.Material = Enum.Material.Neon |
08 | wait( 0.7 ) |
09 | script.Parent.Material = Enum.Material.SmoothPlastic |
10 | wait( 0.7 ) |
11 |
12 | end |
13 | if |
14 | value.Value > 20 |
15 | then |
16 | break |
17 |
18 | end |
do repeat
01 | local value = game.Workspace.Value |
02 |
03 | if value.Value > 20 then |
04 |
05 | repeat |
06 | wait( 0.01 ) |
07 | script.Parent.Material = Enum.Material.Neon |
08 | wait( 0.7 ) |
09 | script.Parent.Material = Enum.Material.SmoothPlastic |
10 | wait( 0.7 ) |
11 | value.Value = value.Value + 1 |
12 |
13 | until value.Value > 30 |
14 | end |
This repeats it 10 times, cause 20 + 1 + 1 + 1 etc will eventually become 30