local Players = game.Players:GetPlayers()
local TopHat = { }
fBeastSpawn = game.Workspace.Map1.MapData.BeastSpawns.fBeastSpawn
sBeastSpawn = game.Workspace.Map1.MapData.BeastSpawns.sBeastSpawn
BeastSpawns = {fBeastSpawn, sBeastSpawn}
table.insert(TopHat, Player)
for _, Player in pairs(Players) do
for i = 1, Player.chancestats.RW.Value do
TopHat[#TopHat + 1] = Player
end
end
local Beast = TopHat[math.random(1, #TopHat)]
COMMUNITY QUESTION
14: bad argument #2 to 'random' (interval is empty)?
1 answer
That error means the math.random on the final line is attempting to calculate with an empty or non-number value. It could be that the second number is somehow appearing as 0. The for loops you have near the end are a bit out of context. Mind explaining what they do and why they are there?
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
I got help from someone, they gave me this chunk of code, I didn't know how to make people have chance stats for being picked so they gave me this chunk... also, hmmm... should I replace the [#TopHat + 1] with [#TopHat + i]?