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

can someone explain to me what the function teleport party asyc does and how to use it?

Asked by 5 years ago

i don't really know what to put here

1 answer

Log in to vote
0
Answered by
Link150 1355 Badge of Merit Moderation Voter
5 years ago
Edited 5 years ago

It teleports a group of players to the same server of a given place and returns a number representing the server they were teleported to.

The purpose of this method is to be able to teleport friends that want to stay together to a different place.

Here is an example of usage:

local TeleportService = game:GetService("TeleportService")

-- this will be the list of players to teleport together
local party = {}

-- for the sake of this example, I'm just going to add anyone who joins
-- the server to the party
game.Players.PlayerAdded:Connect(function(player)
    -- guests cannot be teleported, so I won't add guests to the party
    -- you can identify guests from their negative user ID
    if player.UserID < 0 then
        table.insert(party, player)
    end

    -- 
end)


-- [...]

-- later in your code, you can invoke `TeleportPartAsync` like so
local guid = TeleportService:TeleportPartyAsync (
    78126313 -- this is the place ID to teleport the party to
    party,
    -- here you can add any data to pass to the receiving server. I'll leave this `nil`
    nil,
    -- here you can a ScreenGui to use as a loading screen, I'll leave this `nil` also
    nil
)

print("Teleported all players to server " .. guid)

Note that the last two arguments are completely optional, you don't need to supply anything, not even nil. I'm just passing nil for the sake of this example.

You could very well call TeleportPartyAsync like so:

TeleportService:TeleportPartyAsync(78126313, party)
0
how to use ti xxbrobroxx02 13 — 5y
0
Updated to include example of usage. Link150 1355 — 5y
0
thx alot xxbrobroxx02 13 — 5y
Ad

Answer this question