Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

i don't really know what to put here

1 answer

✓ Accepted answer

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)

3 comments

0

how to use ti

0

Updated to include example of usage.

0

thx alot

This discussion is preserved as it was. New answers, comments, and votes are closed.