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

Random number but picking specific numbers?

Asked by
Pvzw 19
6 years ago

So I want a script where it picks a random number out of the number I gave it.

Script so far:

local x = 0 

local function random()
    x = math.random(685421 or 529394 or 592048 or 90000) 
end

while true do 
    script.Parent.Text = x
    wait(1) 
end

Thank you, if you help.

0
local numbers = {"685421","529394","592048","90000"} local x = 0 local function random() for _, v in pairs(numbers) do x = math.random(v) end end greatneil80 2647 — 6y
0
^ like greatneil said, put them into a table its far more civilized Vulkarin 581 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
local numbers = {685421,529394,592048,90000}
local function getRandom()
    return numbers[math.random(1,#numbers)]
end

while wait(1) do
    script.Parent.Text = getRandom()
end
Ad

Answer this question