How to create and join a private server in-game roblox?

Viewed 1300

So for example, In the game Piggy, there is build mode, where it creates and teleports you to the server... Can this be in a screen gui button and also in server-side script?

2 Answers

Use ROBLOX's TeleportService.

https://developer.roblox.com/en-us/api-reference/class/TeleportService

TeleportService:ReserveServer(OptionalGamePlaceThatYouOwn)

Creates and returns a code that can be used to teleport to a private instance of the server.

TeleportService:TeleportToPrivateServer(PlaceId, AccessCode, Player(s))

Teleports player(s) to the private server created with ReserveServer.

Remember that Google is your best friend.

Try using this:

local TeleportService = game:GetService("TeleportService")

local Place = Your place ID

 

script.Parent.Touched:connect(function(hit)

local player = game.Players:GetPlayerFromCharacter(hit.Parent)

if player then

TeleportService:Teleport(Place, player)

end

end)

This code will go into a part in which it will teleport you to you desired location. If you create a place inside of your main game to act as the VIP server service that would help as well.

Related