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

ParticleEmitter Scripting help?

Asked by 8 years ago

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

end

1 answer

Log in to vote
0
Answered by
Uglypoe 557 Donator Moderation Voter
8 years ago

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).

0
how do i write it to link it to the scripts parent color, and which place do i enter the color i choose? cosmothepandaking 0 — 8y
0
script.Parent.Color = ColorSequence.new(Color3.new(1,1,1)) -- This would be the equivalent of what you posted Uglypoe 557 — 8y
Ad

Answer this question