Color3 HSV Problems

When im changing a Color3 Value from a script it changes correctly but it later on starts subtracting from the Val and infinitely does any reason why?

Here is the script i have

    elseif Statement == "setRainbow" then
        if Char.RAINBOW.Value == false then
            Char.RAINBOW.Value = true 
            while Char.RAINBOW.Value == true do
                NumberVal.Value = NumberVal.Value + 0.001
                if NumberVal.Value >= 255 then
                    NumberVal.Value = 1
                end
                local Val = NumberVal.Value 
                CrystalColor.Value = Color3.fromHSV(Val, 1, 1)
                wait()
            end
        else
            Char.RAINBOW.Value = false
            CrystalColor.Value = orignalColor.Value
        end
    end
end

Color3.fromHSV only accepts parameters ranging from 0 to 1.

1 Like

Oh thats the problem lol thanks it fixed it.