How to replicate colors of a series of individual parts to a UI Gradient?

I have a series of individual parts with different colors, how do I put those colors on a ui Gradient?

2 Likes

You’d need to use ColorSequence, assuming you’re familiar with it.

2 Likes

Yes but im stuck To do it I would need to set the start and end too and im just stuck on that part. When I loop through the folder it ends up going to the last color

Well you’d first have to determine the order in which you want the parts’ colours to appear on the ColorSequence. So create your table and add each part to the table. Then sort the table if you’d like to (easiest way would be to use table.sort and provide a comparison function).

Now, iterate through this sorted table of parts for their colours, add the colour to a table, ensure the colours are in the correct order.

Now, for each of these colours, make a ColorSequenceKeyPoint and add them to a table. The time (first argument) would be at whatever the current index is divided by the number of colours (so index / #colours). The colour (second argument) would be the colour of the current iteration.

So now you have your keypoints in a table, pass them to ColorSequence.new, and you’re good to go.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.