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

How would I use ColorSequence.new()?

Asked by
sngnn 274 Moderation Voter
5 years ago

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)
0
You need to create a Color3, basically: ColorSequence.new(Color3.new(0, 200, 0)) If it solved, put [SOLVED] in title yHasteeD 1819 — 5y
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.) sngnn 274 — 5y
0
I will send a answer, wait. yHasteeD 1819 — 5y
0
Done. yHasteeD 1819 — 5y

1 answer

Log in to vote
0
Answered by
yHasteeD 1819 Moderation Voter
5 years ago
Edited 5 years ago

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 :)

0
Thank you! sngnn 274 — 5y
Ad

Answer this question