So recently I’ve been trying to make a flicking beam using transparency, for some reason, I’m getting the error: “NumberSequence: requires at least 2 keypoints”
How would I fix this?
Code:
while true do
script.Parent = NumberSequence.new{NumberSequenceKeypoint.new(.1,1)}
wait(.1)
end
Try using parentheses () instead of brackets {}
Idk if this will actually help at all, I’m on mobile rn
Code:
while true do
script.Parent = NumberSequence.new(NumberSequenceKeypoint.new(.1,1))
wait(.1)
end
Error: NumberSequence.new(): table of NumberSequenceKeypoints expected.
Put a script in the part that has the beam and use this:
local Beam = script.Parent.Beam
while true do
Beam.Transparency = NumberSequence.new(0)
wait(math.random(0.01,0.1))
Beam.Transparency = NumberSequence.new(1)
wait(math.random(0.01, 1))
end
Also note that NumberSequence.new()
doesn’t creat a random number like math.random()
I was trying to go for more of a random transparency look such as (.1, .34, .5) not 1 and 0
Then you could use Random:NextNumber.
local Random = Random.new()
print(Random:NextNumber(0, 1))
May I have an example of this, and how I can use it?
Here’s a page on Random
Random:NextNumber(firstNumber, LastNumber)
will return a number between 0
, and 1
or between the two numbers you give it. The two Integer’s are optional.
Random:NextInteger (first_number, last_number)
, will return a number between the two numbers given.
The two Integer’s are not optional.
Random.new()
should be used before as a constructor variable. I also re-did the code I gave you:
local Beam = script.Parent.Beam
while true do
local RandomNumber = Random.new()
Beam.Transparency = NumberSequence.new(RandomNumber:NextNumber())
wait(math.random(0.01,0.1))
Beam.Transparency = NumberSequence.new(RandomNumber:NextNumber())
wait(math.random(0.01, 1))
end
Place that inside the part with the beam in it.
Hope this helped! 