I tried earlier, says r, g, and b are not valid members of ColorSequenceKeypoint:
local toAdd = Color3.fromRGB(0, 0, 0)
for i, v in pairs(color.Keypoints) do
toAdd = Color3.fromRGB(toAdd.r+(color.Keypoints[i][2].r), toAdd.g+(color.Keypoints[i][2].g), toAdd.b+(color.Keypoints[i][2].g))
end
toAdd = Color3.fromRGB(toAdd.r/#color.Keypoints, toAdd.g/#color.Keypoints, toAdd.b/#color.Keypoints)
I looked for other solutions, some say look for just the keypoint, it said it was nil when I tried.
local function ifColor3(color, toConvert)
if typeof(color) == "BrickColor" and toConvert == "Color3" then
local colorToConvert = color.Color
return colorToConvert
elseif typeof(color) == "ColorSequence" and toConvert == "Color3" then
local toAdd = Color3.fromRGB(0, 0, 0)
for i, v in pairs(color.Keypoints) do
toAdd = Color3.fromRGB(toAdd.r+(v.Value.r), toAdd.g+(v.Value.g), toAdd.b+(v.Value.b))
end
toAdd = Color3.fromRGB(toAdd.r/#color.Keypoints, toAdd.g/#color.Keypoints, toAdd.b/#color.Keypoints)
return toAdd
elseif typeof(color) == "table" and toConvert == "Color3" then
end
end
I should have mentioned. The R, G and B returned are in the Color3.new format. To actually get the RGB that ranges from 0 - 255, you will need to convert it.
Yes simply multiply by 255. If you need any more help, let me know.
I have no clue why Roblox thought it was a good idea to have the default colour range from 0 to 1. Odd design decisions that we will never know haha
It still seems to be a Color3.new format. Also, am I getting the average correctly?
local toAdd = Color3.fromRGB(0, 0, 0)
for i, v in pairs(color.Keypoints) do
print(v.Value)
toAdd = Color3.fromRGB(toAdd.r+(v.Value.r*255), toAdd.g+(v.Value.g*255), toAdd.b+(v.Value.b*255))
end
toAdd = Color3.fromRGB(((toAdd.r)/#color.Keypoints), ((toAdd.g)/#color.Keypoints), ((toAdd.b)/#color.Keypoints))
return toAdd
Still gives a value lower than 1, far, far lower, here’s the final Color3 value (Total)
I already know this, I’m just asking if I have converted it correctly because it’s still so small and acting like it’s still color3.new instead of fromRGB
I think it should be fine. As I said I think the reason why that happens might be because you are inputting 0. It could be that you don’t have an actual value in the Color3Value.