Particle emitter lifetime in script, how to make it work?

I’m trying to make a particle emitter have a lifetime of .5 seconds in a script. But it’s saying that it must be a number range. How do i make it be a number range? i’m currently trying with

bruhparticle(example)

bruhparticle.Lifetime = .5

this does not work, please help

3 Likes

You use the NumberRange.new(n) constructor to create a new instance of the NumberRange class.

But you don’t need a script to do it, you can just do it through the properties window.

4 Likes

This is the kind of thing you need to search up and test for before posting a thread about it.

ParticleEmitters accept NumberRange objects for the value of Lifetime only. Therefore, you need to create one and then assign it to Lifetime.

A single value passed to the constructor method will use that value as both the minimum and maximum.

bruhparticle.Lifetime = NumberRange.new(0.5)
3 Likes

haha how do i make a colorsequence, i tried looking for help by myself in the colorsequence constructors page but i did not understand

1 Like

That’s a question for a new topic.

ColorSequences are also created from the new constructor. You can pass either one Color3 value, two Color3 values or a table of ColorSequenceKeypoints in order to create sequences.

One Color3 will apply the color as the start and end value of the sequence. Two of them will use the first as the start and the second as the end. A table of ColorSequenceKeypoints allows you to specify at what points colors should change. There’s a minimum of two if I remember correctly, which are the start (time = 0) and end (time = 1) keypoints.

3 Likes