Could anyone explain what NumberSequence and NumberSequenceKeypoints are in a simple way?
Hey there.
As you may know, a few instances such as ParticleEmitters or Beams (for example) have a Transparency property that can be manipulated with a graph instead of just a single integer.
A NumberSequence lets you manipulate that through a script.
A NumberSequenceKeypoint allows for the creation of a new point in your graph. Let’s say you wanted to have a graph/sequence that goes from Transparency 1 - 0.5 - 1. Here’s how you would do that:
local Sequence = NumberSequence.new(
NumberSequenceKeypoint.new(0, 1),
NumberSequenceKeypoint.new(0.5, 0.5),
NumberSequenceKeypoint.new(1, 1)
)
As you can see, a NumberSequenceKeypoint has two parameters, these being (time, value)
(They do have an optional third “envelope” parameter but for a simple explanation it’s not necessary)
In our example above we created our first point right at the start by setting the first parameter (time) as 0 and putting our value (the transparency in this case) to 1.
Then we set it to 0.5, 0.5 to make it half-transparent in the middle and then once again 1, 1 to make it transparent again at the end.
Now you could simply set (YourInstance).Transpareny = Sequence
TL;DR: They’re used to manipulate transparency graphs through scripts (like in ParticleEmitters or Beams)
Thank you for the explanation!
But why does it require a sequence instead of an integer? And why would I need to manipulate it?
I just want to set its transparency right away to 1
.
I suppose its because it allows for additional functionality of these instances, and it sure would suck if I couldn’t achieve a desired particle effect because roblox wouldn’t allow me to do so in a script. Uses of this would be particles and beams, it allows for cooler and more specific effects. Think of a force field which pulsates with energy, a number sequence would be required to achieve that effect. So next time, when you find a feature inconvenient think about the reasoning behind said feature.
Thank you! Wish I could mark two posts as the solution.
Thank you for the explanation. I didn’t know about it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.