So I have this script that is supposed to choose a random element of an array.
However, it isn't working.
Output gave me this: 17:06:56.907 - Workspace.Elections.Script:16: bad argument #2 to 'random' (interval is empty)
Here's the script:
while wait(0.1) do
if script.Parent.SetUp.Value == true then
SetUp.Value = false
local MapChoices = {
["Map1"] = "Map",
["Map2"] = "Map",
["Map3"] = "Map",
["Map4"] = "Map",
["Map5"] = "Map",
}
local ModeChoices = {
["Mode1"] = "Mode",
["Mode2"] = "Mode",
["Mode3"] = "Mode",
}
local x = math.random(1, (#MapChoices))
local y = math.random(1, (#ModeChoices))
Choice1 = MapChoices[x]
Choice1.Mode = ModeChoices[y]
x = math.random(1, (#MapChoices))
y = math.random(1, (#ModeChoices))
Choice2 = MapChoices[x]
Choice2.Mode = ModeChoices[y]
x = math.random(1, (#MapChoices))
y = math.random(1, (#ModeChoices))
Choice3 = MapChoices[x]
Mode = ModeChoices[y]
wait(0.1)
end
end

3 comments
bad argument #1 to 'random' (interval is empty)
He just gave you the solution.
Sorry about that. Forgot to change something with the rest of the code.