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)]
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?