Hi there! I'm trying to create a game where one player is selected to kill the other players anonymously. How would you do this? I've created a script already but it hasn't worked.
function randomizer() local players = game.Players:GetChildren() local rPlayer = game.Players:GetPlayers() [math.random(1, #players)] wait(5) rPlayer.TeamColor = BrickColor.new("Really red") end randomizer()
The error message reads
15:25:18.309 - ServerScriptService.Selecter:4: bad argument #2 to 'random' (interval is empty)
What does this mean? Is something wrong with the script?
function randomizer() local players = game:GetService(:Players"):GetPlayers() print(players[math.random(1, #players)]) end while wait(1) do randomizer() end
Here is another way, you can obviously change the print to whatever you want! Here is an example what you can do!
function randomizer() local players = game:GetService(:Players"):GetPlayers() local i = (players[math.random(1, #players)]) --now the random player is located as i, do whatever you want with it! i:Kick("hello!") --example end while wait(1) do randomizer() end