I need a script that teleports players to a random place in a universe. I'm creating an FPS with a lobby and I want it to teleport to a random place in that universe. How do I do this?
COMMUNITY QUESTION
How to make all the players in one place teleport to a random place?
1 answer
Create a table of placeids and then use the math.random() random number generator to choose one of them from the table randomly:
places = {1818, 1457, 16745} --Fill this table with the id's for the different places
chosenPlace = places[math.random(1,#places)]
--Assuming this is in a LocalScript
game:GetService('TeleportService'):Teleport(chosenPlace)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Is this a server script or a LocalScript? If it's a server script then you're missing the player argument for the teleport.
@coo1o, you may have overlooked the comment in the Code Bock I posted that reads "assuming this is in a LocalScript" ;)