Hello, i want to randomly choose a number, so i use:
local nr = math.random(1,6) if nr ==1 then end
but this time i want to randomly choose a number like 1,2,3,4 and 6(not 5) butt
local nr = math.random(1,6) ---chooses 5 too some times,soo..
how can i make it to choose just 1,2,3,4 or 6?(not 5)
local function randomNumber() nr = math.random(1, 6) if nr == 5 then randomNumber() else break end
or
Nums = {"1", "2", "3", "4", "6"} -- Allowed Numbers size = 0 for _ in pairs(Nums) do size = size + 1 end nr = Nums[math.random(1, size)]