Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I use ColorSequence.new()?

I'm not sure how to use it. I have a part that puts particles into the player's torso when stepped on, but I want the particles to be green. I have to use a ColorSequence and I couldn't find any information on how to use it.

script.Parent.Touched:Connect(function(part)
	if part.Parent.Humanoid then
		local particles = Instance.new("ParticleEmitter")
		particles.Color = ColorSequence.new(0,200,0)
		game:GetService("Debris"):AddItem(particles,5)
	end
end)

4 comments

0

You need to create a Color3, basically: ColorSequence.new(Color3.new(0, 200, 0)) If it solved, put [SOLVED] in title

0

It works, but how would I use this if I wanted it to change colors at different times? (After you answer this I will put it as solved.)

0

I will send a answer, wait.

0

Done.

1 answer

✓ Accepted answer

For one color use ColorSequence.new(Color3), in your case: ColorSequence.new(Color3.new(0, 200, 0))

Basically for put diferrent colors, you need to create a Keypoint, ColorSequenceKeypoint.new(Time, Color3)

save it to a variable and on put the ColorSequence load it in a table...

So. the time is limited to 0(Start) and 1(End)

Here a example:

local ParticleEmitter = script.Parent.ParticleEmitter
local Red = ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0))
local Blue = ColorSequenceKeypoint.new(0.5, Color3.fromRGB(0, 0, 255)) --> 0.5 the middle of end
local EndRed = ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 0))
ParticleEmitter.Color = ColorSequence.new({Red, Blue, EndRed})

Wiki pages:

ColorSequence

ColorSequenceKeypoint

Hope it helped :)

1 comment

0

Thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.