#Help with simple random

1 messages · Page 1 of 1 (latest)

white ibex
#
while true do
    wait(0)

     randomNumber = math.random(1,100)

    if randomNumber <= 70 then
        print("A") 
    elseif randomNumber <= 10 then 
        print("B") 
    elseif randomNumber <= 20 then 
        print("C") 
    end
end```
 this only prints "A"
idk why
misty helm
#

becouse it is always less than 70, the first condition is always meeting and it wont check for the ones down there

white ibex
#

i got 9 and it still prints A

abstract snow
#

This will only ever print A

#

Like cesar said, it's always below 70, so it'll just trigger the first condition and ignore the rest

white ibex
#

HOW TO FIX

abstract snow
#

Rearrange

white ibex
#

how

#

down to up?

abstract snow
#

Elseifs go in order, so if the previous condition fails, then it moves to the next one and so on

misty helm
white ibex
#

ok

#

it works now

#

Im so dumb

#

but i got less dumb now

#

@misty helm @abstract snow Thanks for sharing your wisdom

rotund shell
#

try it

white ibex
rain rover