local Players = game.Players:GetPlayers()
game.Players[Players[math.random(1, #Players)]].TeamColor = BrickColor.new("Bronze")
The code above is giving this error:
ServerScriptService.GameCore:37: bad argument #2 to 'random' (interval is empty)
local Players = game.Players:GetPlayers()
game.Players[Players[math.random(1, #Players)]].TeamColor = BrickColor.new("Bronze")
The code above is giving this error:
ServerScriptService.GameCore:37: bad argument #2 to 'random' (interval is empty)
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
Your error message (interval is empty) is telling you the length of Players is 0, which means your code is running before any actual players have joined the game. You're also indexing Players twice, which means you're indexing players for a random player instead of a random index.