I want to make my trail color smoothly change from a color to another color how can i make this?
it will change from blue to yellow.
You could use while loop to change color and just set the wait to 0/nothing like:
while r <= 255 do
r += 1
wait()
end
while g <= 255 do
g += 1
wait()
end
while b <= 255 do
b += 1
wait()
end
Normally we’d use TweenService to smoothly tween the color, but in this case we’re not able to use TweenService to tween the Trail’s color since it’s using a ColorSequence, which we cannot tween unfortuntely. However, you can create your own tweening system with a little trick. Here we’re creating a Color3Value and tween its value and constantly setting the Trail.Color to the Color3Value’s value. Considering you have a single colored trail:
local Trail = ???
local ColorValue = Instance.new("Color3Value")
ColorValue.Value = Trail.Color.Keypoints[1].Value -- Initial Color
local GoalColor = Color3.new(1,0,0)
local Tween = game:GetService("TweenService"):Create(ColorValue, TweenInfo.new(1), {Value = GoalColor})
Tween:Play()
while Tween.PlaybackState ~= Enum.PlaybackState.Completed do --// Constantly setting the Trail's color to the tween's color
Trail.Color = ColorSequence.new(ColorValue.Value)
task.wait()
end
Trail.Color = ColorSequence.new(ColorValue.Value) --// Making sure it has the final color
3 Likes