while true do wait(math.random(1, 4)) print("num1") wait(math.random(1, 4)) print("num2") wait(math.random(1, 4)) print("num3") end
The script would wait the randomly given time and then it would print the "num1" and it would move on to num2 then after some time num3, but how do I make it so it prints all 3 numbers at the same time with the math.random function in one script?
I'm not completely sure if I understood what you're asking correctly, but based on how I interpreted your question, I think this code would work for you:
while true do wait(math.random(1, 4)) wait(math.random(1, 4)) wait(math.random(1, 4)) print("num1") print("num2") print("num3") end
Also, if num1, num2, and num3 are variables, you'll want to change the prints to print(num1)
, print(num2)
, and print(num3)
.
Try using this:
while true do wait(1) spawn(function() wait(math.random(1,4)) print (“bruh”) end) end
I typed this script on my phone btw so could be wrong
Spawn calls a function on a new thread, meaning that there is no wait for the function to return, so more than 2 processes can happen at once
Accept this answer if worked