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

How to get Color to BrickColor with ParticleEmitters?

Asked by 9 years ago

Script is inside ParticleEmitter

script.Parent.Color = script.Parent.Parent.Parent.Parent.Name -- Model is named 'Teal'

Output bad argument #3 to 'Color' (ColorSequence expected, got string)

I am trying to get the ParticleEmitters color to be the same as a models name, which the models name is Teal so pretty much I want the Color to be a BrickColor

The problem I believe is that since a ParticleEmitter has a start and end property to the color it gets confused. I just want both the start and end properties to be set to the script.Parent.Parent.Parent.Parent.Name, which is Teal

  • NinjoOnline

3 answers

Log in to vote
2
Answered by 9 years ago

Particle emmiters use ColorSequence. So far I've been having a lot of trouble with this. Basically a ColorSequence is a combination of 2 color3 values. To access the colour, you'd have to do particleEmmiter.Color.Start or particleEmmiter.Color.End Start and End are the color 3 values that make up the ColorSequence

To get a emmiter to be the same colour as the part I'd do

local bc = BrickColor.new(script.Parent.Parent.Parent.Parent.Name)

local color = bc.Color

script.Parent.Color = ColorSequence.new(color,color)

That technically should work but I had a bit of trouble when I tried.

1
You don't need to have the color property twice on the ColorSequence.new() line unless you're going from one color to another. The wiki states you can have one or two Color3 values as arguments for a ColorSequence. Spongocardo 1991 — 9y
Ad
Log in to vote
1
Answered by 9 years ago
script.Parent.Color = BrickColor.new(script.Parent.Parent.Parent.Parent.Name) --BrickColor variable

If this doesn't work, you have to use a Color3. I'm not very familiar with ParticleEmitters yet.

Log in to vote
1
Answered by
SurVur 86
9 years ago

ParticleEmitter came with a couple new things such as NumberSequences and ColorSequences. To create a new ColorSequence, use ColorSequence.new(). It takes two arguments, which are Color3 values, the first being the StartColor, the second being the EndColor. If you choose to only use 1 argument, it will be both the start and end colors.

Answer this question