I can’t seem to solve my problem. I have been tying to make a bar that tweens a random amount every random seconds. I just can’t get it to wait a random amount of time that goes lower than 1 (like 0.1 or 0.7)
script:
local bar = script.Parent
local randomnumber1 = Random.new()
while true do
wait(0.1)
wait(randomwaittime) -- HERE
local randomsize = randomnumber1:NextNumber(0.01,0.2)
bar:TweenSize(bar.Size + UDim2.new(randomsize, 0, 0, 0), 'InOut', 'Quart')
end
wait(math.random(1, 4))
set 1 to the minimum amount of time you’d like to wait
set 4 to the maximum
well, yeah but this only rotates between 1,2,3, and 4. Not 1 - 1.00 - 4.00. I need to get numbers between like 0.30 - 3.00.
try
wait(math.random(0.3, 3))
I think if you include a float then it’s possible to wait for that amount of time instead of rounding it off to an integer.
no, it just rounds to a whole number if you do that
while true do
local num = Random.new():NextNumber(0.3, 3)
wait(num)
end
I know but where would I put that. If I put it by it’s own then I couldn’t say “num” before or after the loop.
This should probably do the trick
task.wait(Random.new():NextNumber(1 --[[Min]], 4--[[Max]]))
Random.new():NextNumber(min, max)
returns a random number (Including decimals too)
But math.random(min, max)
will only return an integer.
2 Likes
You would have to move it into your loop. Because well if you moved it out like you’re currently, then num becomes a variable that doesn’t change, meaning your random number stays the same because it’s only chosen once.
Yeah, this works. And @Xx_FROSTBITExX’s script prolly works to. thank you!