so im trying to locate a specific color value in a color string like is says the color is [1,1,1] for example and im trying to take the first "1" in there and add another value to it each time a button is pressed. how would i do that?
COMMUNITY QUESTION
How would i locate 1 specific section of a color value?
1 answer
You are looking for Color3.fromRGB. It will allow you to get the independent values of a color, and edit them. Keep in mind Color.R, Color.G, and Color.B all print values between 0-1 so make sure you multiply them by 255 to get the actual R,G,B values.
local color = Color3.fromRGB(5,5,5)
local function AddToColor(r,g,b)
color = Color3.fromRGB(color.R*255 + r , color.G*255 + g, color.B*255 + b)
print(color.R*255,color.B*255,color.B*255)
end
AddToColor(10,10,10) -- Prints (15,15,15)
AddToColor(10,0,0) -- Prints (15,5,5)
This discussion is preserved as it was. New answers, comments, and votes are closed.
