I am trying to make this sandbox game but to join a user's sandbox, you must have a code. I want to know how to make a "room" inside the game that can only be accessible by a key. It's going to be something like Meep city party's, where its a "room" inside the game, Meep city. Thanks!
This site is okay for scripting questions. iiConstable_Subwayx has been targeting asking questions.. So sad of a life, But here!
1 | local TPS = game:GetService( "TeleportService" ) --Get the teleportation service so you can teleport to a private game |
2 |
3 | local code = math.random( 10000 , 99999 ) --Generate the code for using the private server. This could also be used in GUI's |
4 |
5 | local GameID = 123456789 --Put your GameID here |
6 |
7 | script.Parent.Touched:Connect( function (player) --Put this script in a brick. On touch it will teleport you to a private server as well as other people to this server |
8 | TPS:TeleportToPrivateServer(GameID, code, player) --Teleports to the private game server. This could also be used to teleport to an existing private server via the "code" part. |
9 | end ) |