Error: 'Bad argument#2 to 'math.random' (interval is empty)
local murderers = math.random(2, #game.Players:GetPlayers())
The script doesn't work. The error is above
Error: 'Bad argument#2 to 'math.random' (interval is empty)
local murderers = math.random(2, #game.Players:GetPlayers())
The script doesn't work. The error is above
bad argument #2 to 'math.random' (interval is empty): This error occurs when the first argument, or the first number inputted, is more than the 2nd argument.
The first argument of math.random will be the minimum number, while the second argument of math.random will be the maximum number.
local list = game.Players:GetPlayers()
local rand1 = math.random(1, #list)
local murderer1 = list[rand1]
table.remove(list, rand1)
local rand2 = math.random(1, #list)
local murderer2 = list[rand2]
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Thank you!