I need help getting this script to work. I have a NumberValue named RainValue, and another script i have changes the value of it. It should change a ParticleEmitter color to grey, when RainValue = 2, and change the ParticleEmitter color white, when the RainValue = 1. the script below is in the the ParticleEmitter that i want to change. and the location of RainValue is "workspace.WeatherBrick.RainValue" there is only 1 weatherbrick in workspace, and only 1 RainValue. What do i use to change ParticleEmitter color?
local Rain = workspace.WeatherBrick.RainValue.Value
while true do if Rain = 1 then script.Parent.Color = [144.144.144]
end if Rain = 2 then script.Parent.Color = [255.255.255] end
When setting the color of a Particle Emitter, use ColorSequence.new(Color3.new(),Color3.new())
or ColorSequence.new(Color3.new())
. Giving it one argument sets both the start and end color to the same value, giving it two sets the start and end to those separate values.
For more information about ColorSequence, check out its Wiki Page.
On other notes, you're going to need Color3.new() arguments to make this work correctly. When using Color3.new, the RGB values given must be between 0 and 1. This may be confusing as it then shows up as 0-255. This means that white (255,255,255) would be Color3.new(1,1,1) and black (0,0,0) is Color3.new(0,0,0).