Color's fading from one to another

So I have a control panel for lights in a concert. I currently have it so when you click a color on the panel it quite simply changes the color of the light but it’s very sudden. I want it to be able to fade from color to color like if you were to go from blue to red it would fade out of the red into the blue but I’m unsure how to go about this since there’s 12 possible colors you could go to and from. Would anyone have any suggestions on how to go about this since I couldn’t really find much out there.

Thanks :slight_smile:

1 Like

You can try setting up a tween. It will create the gradual transition, just have one for each color and play it whenever you want a certain color.

2 Likes

Change the values in the Color3 | Roblox Creator Documentation.
Or you could use
Color3 Color3:lerp ( Color3 color, number alpha )

1 Like

Use TweenService to change the part’s Color.

I think using Color3.Lerp is fine for this case, unless of course you wanted a different easing style, since lerp = linear interpolation.

You should use this function to create a Tween object, which you can play whenever you want to change colours.

[TweenService:Create]

Here are the parameters for this function.

This means that if you wanted to tween a part’s colour to red 4 times, reversing it back to its original colour afterwards each time, this would be the script (Assuming it is inside of the part)

I haven’t seen your code, so I’m not sure about how you manage the color changes, but here’s what I would do:


Loop through all of the colors on the panel (we’ll call them ColorParts), and create a tween using {Color = ColorPart.Color} as the propertyTable. For the TweenInfo, you can create this once earlier in the script, and then whenever you click on the ColorPart, play this tween. Here’s the pseudocode.

Thank you so much that really helped! :slight_smile:

1 Like

No problem :smile: ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀

1 Like