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

Random Power Cycle not working?

Asked by
Jirozu 71
7 years ago

I was making a random power chooser script that cycles through power and gives a random one, but it seems to keep printing the same thing, a little help?

local Quirks = {"Explosion", "One For All", "Electrifaction", "Giantification", "Super Jump", "Super Regen"}
local RandomNumbers = {5, 10, 15}

for i = 1, #RandomNumbers do
    for i, v in pairs(Quirks) do
        print(v)
        wait()
    end
end

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

The hashtag Means the number of children in the table and RandomNumbers has 3 children so it will always be I = 1 , 3. Why not do

local RandomNumber = math.random(1,3)*5

That will either get 5, 10, or 15.

0
21:08:31.821 - Workspace.Script:5: attempt to get length of local 'RandomNumber' (a number value) Jirozu 71 — 7y
0
Sorry, without the hashtag VelocityTransport 104 — 7y
0
Also include math.randomseed(os.time()) at the top of your program so it gives you better random numbers plasma_node 343 — 7y
0
if you have a short amount tick and os.time dont make a difference farrizbb 465 — 7y
Ad

Answer this question