For example Kahoot it's background color changes really smoothly, how could I edit this script to do something like that?
while true do wait(.25) script.Parent.BackgroundColor3 = Color3.new(85, 0, 127) wait(.25) script.Parent.BackgroundColor3 = Color3.new(0, 85, 255) wait(.25) script.Parent.BackgroundColor3 = Color3.new(0, 170, 0) wait(.25) script.Parent.BackgroundColor3 = Color3.new(255, 255, 0) wait(.25) script.Parent.BackgroundColor3 = Color3.new(255, 85, 0) wait(.25) script.Parent.BackgroundColor3 = Color3.new(255, 0, 0) end
You could use the Color3 lerp method. It takes two arguments: a Color3 value (goal) and a number value (alpha).
Incorporate this into a for loop, and you have a smooth transition between two different colours.
function lerpToColor3(obj, c3) for i = 0, 1, 0.05 do obj.BackgroundColor3 = obj.BackgroundColor3:lerp(c3, i) wait() end end
Where obj is the Gui instance being modified, and c3 is the goal you're trying to reach, e.g.
lerpToColor3(script.Parent, BrickColor.new("Bright red").Color)
I'm not entirely sure whether this is a great implementation or not, but I hope it works! Here's the wiki article for reference.