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

How to use NumberRange.new?

Asked by 5 years ago

How do I use it? If you want, you can provide an example.

1 answer

Log in to vote
0
Answered by
RayCurse 1518 Moderation Voter
5 years ago

A NumberRange is a simple data type in rbxlua consisting of two Numbers. As such, the constructors for NumberRange are relatively simple.

local range = NumberRange.new(3 , 10)
print(range.Min)
print(range.Max)

Another constructor exists that only takes one Number as an argument and sets the Min and Max values to the said number.

local range = NumberRange.new(3)
--range.Min == range.Max

NumberRanges in tandem with NumberSequences are used mainly in a variety of visual effects for example defining the speed of a particle emitted from a ParticleEmitter through its lifetime.

Ad

Answer this question