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 5 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?

local C = game.Lighting.ColorCorrection

script.Parent.DiseaseValues.Cure1.Colourblind.Value = false
script.Parent.DiseaseValues.DiseaseTotal.Counter.Value = 1

i = 0.5
while true do
    i = i - 0.1
    wait(1)
    C.Saturation = i
    if i == -1 then
        break
    end
end
0
Since you know it should stop at -1 why not just use a numerical loop? User#5423 17 — 5y
0
Obviously had a dumb moment. I switched it to a for loop. ConnorThomp 87 — 5y

1 answer

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

Fixed

0
```lua MaximumOverdriven 152 — 5y
Ad

Answer this question