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

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

Asked by 6 years ago

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

Log in to vote
1
Answered by
RayCurse 1518 Moderation Voter
6 years ago
Edited 6 years ago

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

0
Thanks so much! I had no idea how to do ColorSequence or that unions had to be told to usepartcolor. marioblast1244 113 — 6y
Ad

Answer this question