Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this only get the last choice? [solved]

Asked by 7 years ago
Edited by Shawnyg 7 years ago

This question has been solved by the original poster.

I have a table that has 4 different strings, "Choice1", Choice2" and so on.. Whenever I randomize it and print it, it only prints "Choice4", the last string in the table.

Code:

spawns = {"Choice1","Choice2","Choice3","Choice4"}
random = spawns[math.random(1,#spawns)]
print(random)

Any help would be appreciated

0
Try adding math.randomseed(tick()) to warm up the randomizer. antonio6643 426 — 7y
0
Im still getting choice4 with that Warfaresh0t 414 — 7y
0
Nevermind I found a solution, added a wait(1) after math.randomseed(tick()) Warfaresh0t 414 — 7y

Answer this question