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

How to generate a random color for a particle emitter?

Hello, I want to know how I would possibly generate a random color for a Particle Emitter I gave it a try here this is what I tried...

local particles = workspace.Part.ParticleEmitter                 
particles.Color = ColorSequence.new(Color3.new(BrickColor:random(2)), Color3.new(BrickColor.new(34)))

The above code made the color straight up 0's which made it black and didn't appear at all. I hope someone can help me out, Thank you!

1 answer

✓ Accepted answer

You're doing it wrong, it should be BrickColor.new().Color for the Color3 value. And to choose a random color3 value:

-- get it from Color3 values

function rand() -- shorten my code
	return math.random(1,255)/255
end

local color = Color3.new(rand(),rand(),rand())

-- or from BrickColor values

function rand2()
	return BrickColor.Random().Color
end

local color = rand2

And to set it for a ParticleEmitter:

emitter.Color = ColorSequence.new(color1,color2)

2 comments

0

Ok, but that still doesn't show me an example of how I would set a random color to a particle emitter....

0

Sorry, I will edit.

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