Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a smooth color change?

Asked by
Lie_Star -11
4 years ago

For example, you have a part and you can change its color. But how to make the color move smoothly from one to another?

0
TweenService. ScrubSadmir 200 — 4y

2 answers

Log in to vote
0
Answered by
srimmbow 241 Moderation Voter
4 years ago
local ts = game:GetService("TweenService")

local tweenInfo = TweenInfo.new(
    10, --How long the tween takes
    Enum.EasingStyle.Linear, --Tween Style (linear is probably the best one to use in your situation)
    Enum.EasingDirection.Out, --Out is the best for your situation
    0, --How many times you want it to repeat
    false, --If it reverses after
    0 --Delay time in between
)

local data = {Color = Color3.fromRGB(255,0,0)} --This is the color that you want it to be
--                        The part    the tweeninfo   The data
local tween = ts:Create(script.Parent,  tweenInfo,      data)
tween:Play() --Plays the tween
Ad
Log in to vote
0
Answered by
2ndwann 131
4 years ago
Edited 4 years ago

Try using tweening. Tweening is when you make a GUI go smoothly from one color, position, or size, to another color, position, or size.

Look at this article for more info: https://developer.roblox.com/en-us/articles/GUI-Animations

Answer this question