Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Random number but picking specific numbers?

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.

2 comments

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

0

^ like greatneil said, put them into a table its far more civilized

1 answer

✓ Accepted answer
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

This discussion is preserved as it was. New answers, comments, and votes are closed.