won’t work. Here’s the function responsible for this:
local function ifColorSequence(color, toConvert)
if typeof(color) == "BrickColor" and toConvert == "ColorSequence" then
local colorToConvert = color.Color
local toReturn = ColorSequence.new(colorToConvert)
return toReturn
elseif typeof(color) == "Color3" or typeof(color) == "ColorSequence" and toConvert == "ColorSequence" then
local colorToConvert = color
if typeof(color) == "Color3" then
toReturn = ColorSequence.new(colorToConvert)
end
return toReturn
elseif typeof(color) == "table" and toConvert == "ColorSequence" then
for i, v in ipairs(color) do
local colorSequenceKey = ColorSequenceKeypoint.new(v[1], v[2])
table.insert(tableOfSequence, colorSequenceKey)
print((tableOfSequence[i]).Time)
end
return ColorSequence.new(tableOfSequence)
else
error("Given invalid parameters")
end
end
A convert function in the module calls this function, and the error says the keypoints should be in the correct order.
If it’s erroring then can you also actually tell us what the error is? Knowing what you’re getting in the console would be pretty helpful. If it’s just your “Given invalid parameters” error then you’ll want to review your conditionals since they aren’t passing but if it’s a different error then we need to know what it is.
My younger brother is using the PC so I can’t access studio for an hour while he has coding classes, but it said something like “Keypoints should be in order.”
@colbert2677 just gave the error in this reply and in the original post.
16:28:00.981 ColorSequence: all keypoints must be ordered by time - Server - ColorConverter:27
I already ordered it by time using ipairs, pcalling it tells me the script exhausted allowed execution time:
local returned
repeat
local success, toRETURN = pcall(function()
returned = ColorSequence.new(tableOfSequence)
task.wait(0.5)
end)
until success
return returned
UPDATE: Somewhat fixed, a few print statements and some changes and everything seems to be working nicely, except this…
16:51:27.666 0 - Server - ColorConverter:25 --Time of keypoint
16:51:27.666 0.25 - Server - ColorConverter:25 --Time of keypoint
16:51:27.666 0.5 - Server - ColorConverter:25 --Time of keypoint
In your second condition, the assignment of toReturn implies that toReturn is either an upvalue or some kind of global value, yet in the first it’s made a local variable. You also do not use it in your third condition. This also applies to tableofSequence.
The variable colorToConvert is unnecessary in both conditions.
Thanks for the help, although I need help with this one thing related to the module. When converting it to a color3 so that a part’s color can be compatible with the color sequence and turning the part’s color to the result of the conversion, the brick color is different from the color and manually setting the brick color in an attempt to force it won’t work. How would I fix this?
Reference:
Hello? @Fifkee are you still here? I have another problem related to the module.
There are ≈139 BrickColors versus the 16.7 million RGB values provide us. The best thing BrickColor can do is provide us the closest BrickColor an RGB value can represent.