The script doesn't change particle transparency

i tried to make a script that it change particle transparency but it doesn’t work
this is the script:

local smoke = game.Workspace.Smoke_Emitter
local particles = Instance.new("ParticleEmitter", smoke)
particles.Texture = "rbxasset://textures/particles/smoke_main.dds"
particles.Lifetime = NumberRange.new(1.1)
particles.Rate = NumberRange.new(18)
particles.Speed = NumberRange.new(18)
particles.Transparency = NumberSequence.new(0, 1)
local a = math.random(5,15)
wait(a)
particles.Transparency = NumberSequence.new(0, 0)

Well that’s not how NumberSequence datatypes work. If you were to observe how this value works when setting it manually:


You have a start, a finish, and as many dots as you want in between, in the image above there is one dot. You construct a NumberSequence by creating NumberSequenceKeyPoint datatypes inside of a table and passsing that table to NumberSequence.new({first, ..., last}) (first index is the start point, as many other indices as you want, and the last index should be the last point) which represent each point; NumberSequenceKeypoint.new(time, transparency) where transparency is the transparency during a certain time time.

The image above can be described this way:

particleEmitter.Transparency = NumberSequence.new({
    NumberSequenceKeypoint.new(0, 0), -- (start with 0 transparency)
    NumberSequenceKeypoint.new(.5, .75), --(at 50% of the time of the time get 0.75 transparency)
    NumberSequenceKeypoint.new(1, 1) --(at the end be fully transparency)
})

more info

3 Likes

how will the script look llike?

Well depends on what you want, I gave the explanation, figuring it out by yourself would be easy. Make a try and ask me again to see where you’re wrong.

Hint: I see you want to make the transparency 1 at the start, then 0 again. That will require two NumberSequenceKeypoint.

i want it to make it invisible wait a math.random and then make it visible

i need only the one that it makes fully visible

particles.Transparency = NumberSequence.new(1)
local a = math.random(5,15)
wait(a)
particles.Transparency = NumberSequence.new(0)

I forgot to mention, this is not what this property is for, if you want to make the ParticleEmitter disappear for some time just play with the .Enabled property.

particles.Enabled = true
local a = math.random(5,15)
wait(a)
particles.Enabled = false

Hey! You can do a fade by
Instance.new("ParticleEmitter").Transparency = NumberSequence.new(0, 1)
This automatically fades it. Works with only 2 variables though

Here’s how to get the random lifespan effect (it’s a quick fix though)

while true do
wait()
particles.Lifetime = NumberRange.new(Math.Random(5,15))
end

I have no clue how you’d reset the “randomness” with each particle, but this will do the trick for all particle effects you can think of