When I use math.random(10, 20) I get a number between 10 and 20. I want only 2 options. Either 10 or 20. Nothing in between.
You could create a table with the numbers you’d like to choose from (this method is quite scalable if you decide to add more values in the future), and then pick a random value using the indices.
local options = {10, 20}
local choice = options[math.random(1, #options)]
print(choice)
2 Likes
local number = (math.random(1, 2) == 1) and 10 or 20
2 Likes
Thanks! Both work