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

How to script NumberSequences in ParticleEmitters?

Asked by 7 years ago

I can't seem to script any type of NumberSequences for ParticleEmitters. What am I doing wrong, and could I have an example of NumberSequence use in a script?

Here is my current code:

local plr = game.Players.LocalPlayer
local chr = plr.Character

local particleEmitter = Instance.new("ParticleEmitter", chr.Torso)

local heartsSizeSequence = "0 0.2 0 0.499452 0.3125 0 1 0.2 0"
local heartsSequence = NumberSequence.new(heartsSizeSequence)

particleEmitter.Size = heartsSequence

2 answers

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Had this problem a while back! It's actually rather easy! The number sequence is actually expected to be in brackets using Vector3.new(0,0,0) etc! (Depending on what you have in mind)

Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

Crunchy_Roll's method does not work for every circumstance, but it indeed does work.

Anyways, I solved it in circumstances that will work every time.

You can use an array with the values and call them in NumberSequenceKeypoint.new(time, value, envelope).

Hence:

local heartsSizeSequence = {"0", "1"}
local keypoints = {NumberSequenceKeyPoint.new(0, heartsSizeSequence[1], 0), NumberSequenceKeyPoint.new(1, heartsSizeSequence[2], 0)}

particleEmitter.Size = NumberSequence.new(keypoints)

Answer this question