Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to teleport 2 players to a private server with a countdown (it must be touchable)?

Asked by 5 years ago
Edited 5 years ago

I need to teleport 2 players to a privete server with a countdown i don't have much idea about group teleportation can you guys help me about this and do you know a way to make the countdown with it.

1
Not a req site. kittonlover101 201 — 5y
0
Yup, not a request site! BashGuy10 384 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Assuming you are asking for a full tutorial on how to teleport multiple players to another place in the same game, I am here to give you the full tutorial.

Theoretically, you could teleport multiple players with things other than a part, but for simplicity, this will be using a part to teleport multiple players.

What you want to do is create a Part in Workspace. You can do whatever you want to this part, as long as multiple players are able to touch this part. After you have placed the part in Workspace, place a Script inside the part.

Inside the script, the code should look something like this:

01local Players = game.Players
02local PlayersTouching = {}
03local Timer = 10
04local NeededPlayers = 1 -- Change to amount of players needed to start timer
05local PlaceId = 0 -- Place GameId here
06 
07local Toucher = script.Parent
08local RunService = game:GetService("RunService")
09local TeleportService = game:GetService("TeleportService")
10 
11function IsPlayer(obj)
12    if obj.Parent:IsA("Model") and obj.Parent:findFirstChild("Humanoid") then
13        if Players:GetPlayerFromCharacter(obj.Parent) ~= nil then
14            return true
15        end
View all 87 lines...

Extra advice: In order to make sure that the Toucher.TouchEnded event does not fire when it is not needed to fire, it is important to make sure that the Part that was placed in Workspace is not collidable, anchored, transparent, and touches all parts of the Character. This can be done by creating a very large part that covers a lot of area.

I hope that helps! :D

0
You are an awesome human this looks perfect i will try. thank you TheMostDelikanliMan -14 — 5y
Ad
Log in to vote
1
Answered by
RSASDSA 72
5 years ago
Edited 5 years ago

To teleport any number of players to a private server, you have to use the TeleportService, specifically TeleportService:ReserveServer and TeleportService:TeleportToPrivateServer (linking to rbxts types docs for that function because the devhub is terrible) First, you have to create a private server with TeleportService:ReserveServer.

1local TeleportService = game:GetService("TeleportService")
2local serverAccessCode = TeleportService:ReserveServer(game.PlaceId)

Then, you have to get the group of players.

1local playersYouWantToTeleport = {} -- This should be an array of Players

To make the delay we use the wait function

1local delayTime = 30
2wait(delayTime)

And to teleport the players we use TeleportService:TeleportToPrivateServer

1TeleportService:TeleportToPrivateServer(game.PlaceId, serverAccessCode, playersYouWantToTeleport)

Answer this question