Can you tween a single-color ColorSequence?

Hello,
I need to tween a ColorSequence inside a ParticleEmitter, thing is, the particles need only 1 single color so I was wondering if there was a way to tween the 1 keyframe inside ColorSequence or if there was a way to convert Color3 to a ColorSequence. I’ve already read

but they are talking about a multiple-keyframed ColorSequence, I only need 1 color.
Thanks.

1 Like

It’s actually pretty simple to convert a color3 to a color sequence:

local testColor3 = Color3.fromRGB(127, 255, 0)
local testColorSequence = ColorSequence.new(testColor3)
1 Like
local colorSeq = ColorSequence.new{ColorSequenceKeypoint.new(1, Color3.new(1, 1, 1))}
1 Like

That won’t work, as all ColorSequences have to have at least 2 color sequence keypoints, first keypoint has to have a time of 0 and the last keypoint has to have a time of 1.

1 Like

It has a length of 1? Thanks for trying, I guess. I wasn’t aware 2 were required but you could just add 1 with a length of 0.

1 Like

Thanks for your replies, currently Roblox isn’t working properly and I can’t test what I wanted to test, I’ll let you know if any of what you replied works as soon as Roblox is working again :slight_smile:

1 Like

I tried with:

			local smokeTween = tweenService:Create(cauldron.Smoke.ParticleEmitter, TweenInfo.new(3), {
				Color = ColorSequence.new{
					ColorSequenceKeypoint.new(0, randomColor),
					ColorSequenceKeypoint.new(1, randomColor)
				}})

but it says:
TweenService:Create property named ‘Color’ on object ‘ParticleEmitter’ is not a data type that can be tweened

So I guess there’s no way to tween a colorSequence?

Not able to use Studio rn because I’m on my study laptop, but I whipped up this code and maybe you could try this:

local firstColor = --A color3
local colorSequence = ColorSequence.new(firstColor)
local notNeeded = --a random part, will be used later but may or may not be used in game
notNeeded.Color = firstColor
local toTween = --Another color3
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(--[[tweenInfo]])
local tween = TweenService:Create(notNeeded, info, {Color = toTween})
local runService = game:GetService("RunService")
local function AFunction()
   local currentColor = notNeeded.Color
   colorSequence = ColorSequence.new(currentColor)
   --Do whatever
   task.wait()
end
tween:Play()
local connection = runService.Heartbeat:Connect(AFunction())
tween.Completed:Wait()
connection:Disconnect()
2 Likes

Thank you! I will try to implement it into my code and let you know :slight_smile:

I had some struggles to figure out what the code did at first, but now it works PERFECTLY.
Thank you so much!

1 Like

No prob!

min characters why

1 Like