Hello,
so I’m currently doing this for a rank lock for a group. I tried doing this as a way of getting numbers inbetween 20, 47
number1 = 20
number2 = 47
local randomnumber = math.random(number1, number2)
print(randomnumber)
But it just picks a random number. I want it to pick ALL the numbers inbetween them. I do know getchildren has to do with that, but I’m not sure how to write it.
Thanks in advance.
if by numbers you were referring to integers then you’d use a for loop
for i=20,47 do
...
end
Let me know your use-case, because this is vague.
GetChildren has nothing to do with this.
If you want to iterate over all of the numbers, do this.
for n = number1, number2 do
If you want to get a random number in between them, do this.
math.random(number1, number2)
If you want a list of everything in between, do this.
local t = {} for n = number1, number2 do table.insert(t, n) end
If you want to check if a number is between them, do this.
if x > number1 and x < number2 then
Oh woops, never thought of that. Sorry, just recently woke up. Thank you it fixed my problem.
1 Like