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

How do I change a ParticleEmitter's Color with Color3Value?

I want the ParticleEmitter to change it's color but it keeps giving me this error:

18:25:04.004 - Workspace.Slot1.ParticleSlot1.ParticleScript:7: bad argument #3 to 'Color' (ColorSequence expected, got Color3) 18:25:04.005 - Stack Begin 18:25:04.006 - Script 'Workspace.Slot1.ParticleSlot1.ParticleScript', Line 7 18:25:04.007 - Stack End

I don't know how to get ColorSequence in a Value Object to put in a model but this is the code that I have right now:

local Union = script.Parent.Union
local Particle = script.Parent.Part.ParticleEmitter
local Armor = game.Workspace.BasicArmor.BasicWaterArmor.BasicWaterArmorLevel1
local Color = Armor.ColorValue.Value

Union.Color = Color
Particle.Color = Color

The code is in a regular script. Also, for some odd reason, the Union isn't changing it's color and isn't giving out an error. Is there a way to fix this? Any help is appreciated!

1 answer

✓ Accepted answer

Your union isn't changing color because the UsePartColor property of the union is set to false. Set it to true.

For the particle emitter, keep in mind that the Color property is a ColorSequence and not a Color3 value. In order to set the color of the particle emitter correctly you would have to construct a ColorSequence value from the Color variable in your code.

local Union = script.Parent.Union
Union.UsePartColor = true
local Particle = script.Parent.Part.ParticleEmitter
local Armor = game.Workspace.BasicArmor.BasicWaterArmor.BasicWaterArmorLevel1
local Color = Armor.ColorValue.Value
 
Union.Color = Color
Particle.Color = ColorSequence.new(Color)

You can read more about ColorSequences here: http://wiki.roblox.com/index.php?title=API:ColorSequence

1 comment

0

Thanks so much! I had no idea how to do ColorSequence or that unions had to be told to usepartcolor.

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