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

My script is meant to break when Saturation reaches -1, but it is not?

Asked by 6 years ago

The script is meant to lower the Saturation to -1, then when it hits -1 it is meant to stop. However, it continues to lower the saturation, and does not stop.

How can I make it stop at -1?

01local C = game.Lighting.ColorCorrection
02 
03script.Parent.DiseaseValues.Cure1.Colourblind.Value = false
04script.Parent.DiseaseValues.DiseaseTotal.Counter.Value = 1
05 
06i = 0.5
07while true do
08    i = i - 0.1
09    wait(1)
10    C.Saturation = i
11    if i == -1 then
12        break
13    end
14end
0
Since you know it should stop at -1 why not just use a numerical loop? User#5423 17 — 6y
0
Obviously had a dumb moment. I switched it to a for loop. ConnorThomp 87 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
1for i=0.5,-1, -.1 do
2      wait(1)      
3   C.Saturation = i
4end

Fixed

0
```lua MaximumOverdriven 152 — 6y
Ad

Answer this question