Hi there. Been making recently some UIs until I ran into a problem. So I made a frame and added the ‘UI Gradient’ object to it so that the color of the frame can be, well, a gradient. I set the color sequence to a dark green at position 0 and a slightly lighter green at position 1. Now I wanted to make it so that once a button is clicked, that the Dark Green-Light Green gradient transforms into a Dark Red-Light Red gradient. So far no problems yet, I used the following code to change the colorsequence on the UI Gradient:
Location.UIGradient.Color = ColorSequence.new { ColorSequenceKeypoint.new(0, DarkRed), ColorSequenceKeypoint.new(1, LightRed) }
After I tested this, and found out it was working perfectly, I wanted to do a slight change to the script so that the transition from one color sequence to another is tweened, making it look way more smooth. So I edited the script to this:
game:GetService('TweenService'):Create(Location.UIGradient,TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut), {Color = ColorSequence.new { ColorSequenceKeypoint.new(0, DarkRed), ColorSequenceKeypoint.new(1, LightRed) }}):Play()
And this is where I got the following error: “TweenService:Create property named ‘Color’ on object ‘UIGradient’ is not a data type that can be tweened”.
My question here is:
- Is it possible to somehow make a smooth color transtion on UI Gradients using TweenService?
- And if yes, how could I achieve it?
Thank you for your attention. I’m looking forward to any type of help.