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

How to change a ParticleEmitters lifetime via script?

Asked by
Soliate 80
10 years ago

I've tried to get this to work but the output is saying that I'm using a bad argument,

Here is my code,

1local p = script.Parent
2local pe = p.ParticleEmitter
3 
4pe.Lifetime = 5

It's probably a very simple fix, I've most likely just made a mistake, but I can't spot it out, thanks!

1 answer

Log in to vote
5
Answered by
Redbullusa 1580 Moderation Voter
10 years ago

Use the NumberRange.new() constructor, since ParticleEmitter.Lifetime is a NumberRange property.

1Part = script.Parent
2ParticleEmitter = Part.ParticleEmitter
3 
4ParticleEmitter.Lifetime = NumberRange.new(8, 10) -- This constructor accepts 1 or 2 arguments.
0
Thats neat. woodengop 1134 — 10y
Ad

Answer this question