Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Random Power Cycle not working?

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

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.

4 comments

0

21:08:31.821 - Workspace.Script:5: attempt to get length of local 'RandomNumber' (a number value)

0

Sorry, without the hashtag

0

Also include math.randomseed(os.time()) at the top of your program so it gives you better random numbers

0

if you have a short amount tick and os.time dont make a difference

This discussion is preserved as it was. New answers, comments, and votes are closed.