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

Another error found in my scripts?

Asked by 9 years ago

Well I keep seeming to find errors in this script of mine, I will ask one by one. Thank you scripting helpers for this site. Anyways, I was using a table for example:

local pies = {a,b,c,d,e,f,g}
local noobs = math.random(1, #pies)
print(noobs[pies])

What seems to be wrong?

0
Just want to point out to you that when using random numbers, if the range starts with 1, then implying it is unneeded, just do math.random(#pies) BSIncorporated 640 — 9y

1 answer

Log in to vote
2
Answered by
Hybric 271 Moderation Voter
9 years ago

You switched pies and noobs, should be pies[noobs]

Ad

Answer this question