My game has a max of four players, and I would like to be able for a script to choose one of the four randomly and teleport them to a different game.
Thank you for helping!
My game has a max of four players, and I would like to be able for a script to choose one of the four randomly and teleport them to a different game.
Thank you for helping!
You would do this by using math.random.
To get you started here is some example code:
PlayersTable = game.Players:GetPlayers() -- This creates a table containing all the players
MaxPlayers = PlayersTable[math.random(1,#PlayersTable)] -- Randomly selects a player from PlayersTable
ROBLOX Wiki on math.random: http://wiki.roblox.com/index.php?title=Math.random
This discussion is preserved as it was. New answers, comments, and votes are closed.