Ok, so: I am working on a game and I need atmosphere for this, but something don’t work.
I need have cyan colour and a black colour. Lets say cyan is the atmosphere of the earth and black is the space. So, now I tried to move from cyan to black using this code on a part:
local function lerp(a, b, c) --This is the regular lerp function, don‘t ask me how it works it‘s just this
return a + (b - a) * c
end
local Hue, Saturation, Value = Color3.new(90, 253, 255):ToHSV()
local part = workspace.Part
while true do
for i = 0, 1, 0.1 do
wait(1)
part.Color = Color3.fromHSV(Hue, Saturation, lerp(Value, 0, i))
end
for i = 1, 0, -0.1 do
wait(1)
part.Color = Color3.fromHSV(Hue, Saturation, lerp(0, Value, i))
end
end
What am I doing here? I first get my colour, the Cyan colour. Then I port it from the RBG system to the HSV system. Why? Because I thought it would be much easier to use the lerping. Here is a picture with my main motive:
You can see that if the Value is at 0 then the colour is black, but if it is at 255 then the colour will be the acctua colour. You can even see the smooth transition between cyan and black.
Now, what‘s my problem? My problem is that my code just dosen‘t work and I don‘t know why. It is my first time that I need to do something like this and I not really know much about colours. So, the part just change it colour to red, darkblue, pink, orange, yellow and black, but I just wanted that it changes from cyan to black, like in the image. Lets get again the example with the atmosphere. I think that if you would go to the space then the atmosphere would change it‘s colour from cyan to black, not from cyan to pink, yellow, orange, etc. and then black.
EDIT:
@RoyStanford helped me to understand what @gillern was trying to say me, you should see his reply, too: