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

I need help, how do I make it print a word instead of a number?

Asked by
Xayzen 2
3 years ago
local possibilities = {"Brawler", "Bulky", "Boomer", "Loose Cannon", "Glass Cannon", "Big Brain", "Bookworm", "Lazy", "Inexperienced", "Nerd", "Runner", "Ducker", "Inaccurate", "Blitz", "Bot", "Grinder", "Persistant", "Tryhard", "Bruiser", "Rash", "Tank", "Braindead", "Casual", "Explosive", "Juggernaut", "Intellect", "Natural", "Instinctive", "Mage", "Slow Cannon"}
local textNum
for i = 1, 30 do
textNum = math.random(#possibilities)
print(textNum)
wait(2)
end

2 answers

Log in to vote
0
Answered by 3 years ago

To read from an array you need to add a pair of brackets after its reference and specify the index number of the element inside ([pos])

local possibilities = {"Brawler", "Bulky", "Boomer", "Loose Cannon", "Glass Cannon", "Big Brain", "Bookworm", "Lazy", "Inexperienced", "Nerd", "Runner", "Ducker", "Inaccurate", "Blitz", "Bot", "Grinder", "Persistant", "Tryhard", "Bruiser", "Rash", "Tank", "Braindead", "Casual", "Explosive", "Juggernaut", "Intellect", "Natural", "Instinctive", "Mage", "Slow Cannon"}
local textNum
for i = 1, 30 do
textNum = math.random(#possibilities)
print(possibilities[textNum])
wait(2)
end
0
Thanks for explaining it! this really helps Xayzen 2 — 3y
Ad
Log in to vote
0
Answered by
Raccoonyz 1092 Donator Moderation Voter
3 years ago
local possibilities = {"Brawler", "Bulky", "Boomer", "Loose Cannon", "Glass Cannon", "Big Brain", "Bookworm", "Lazy", "Inexperienced", "Nerd", "Runner", "Ducker", "Inaccurate", "Blitz", "Bot", "Grinder", "Persistant", "Tryhard", "Bruiser", "Rash", "Tank", "Braindead", "Casual", "Explosive", "Juggernaut", "Intellect", "Natural", "Instinctive", "Mage", "Slow Cannon"}
local textNum
for i = 1, 30 do
textNum = math.random(#possibilities)
print(tpossibilities[textNum])
wait(2)
end
0
Ohh damn thanks a lot Xayzen 2 — 3y

Answer this question