Teleport Service
*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.
Resumen
Propiedades
Métodos
GetLocalPlayerTeleportData():Variant |
GetPlayerPlaceInstanceAsync(userId: User):Tuple |
GetTeleportSetting(setting: string):Variant |
PromptExperienceDetailsAsync(player: Player,universeId: number):Enum.PromptExperienceDetailsResult |
ReserveServer(placeId: number):Tuple |
ReserveServerAsync(placeId: number):Tuple |
SetTeleportGui(gui: Instance):() |
SetTeleportSetting(setting: string,value: Variant):() |
TeleportAsync(placeId: number,players: {Player},teleportOptions: Instance):Instance |
TeleportPartyAsync(placeId: number,players: Instances,teleportData: Variant,customLoadingScreen: Instance):string |
TeleportToPrivateServer(placeId: number,reservedServerAccessCode: string,players: Instances,spawnName: string,teleportData: Variant,customLoadingScreen: Instance):() |
TeleportToSpawnByName(placeId: number,spawnName: string,player: Instance,teleportData: Variant,customLoadingScreen: Instance):() |
Eventos
LocalPlayerArrivedFromTeleport(loadingGui: Instance,dataTable: Variant):RBXScriptSignal |
TeleportInitFailed(player: Instance,teleportResult: Enum.TeleportResult,errorMessage: string,placeId: number,teleportOptions: Instance):RBXScriptSignal |
Referencia API
Propiedades
Customized Teleport UI
Métodos
Get Arriving Teleport Gui
Devuelve
Muestras de código
Manejo de una GUI de Carga de Teleportación
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local customLoadingScreen = TeleportService:GetArrivingTeleportGui()
if customLoadingScreen then
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
ReplicatedFirst:RemoveDefaultLoadingScreen()
customLoadingScreen.Parent = playerGui
task.wait(5)
customLoadingScreen:Destroy()
endGet Local Player Teleport Data
Teleport Service: Get Local Player Teleport Data():Variant
Devuelve
Variant
Muestras de código
Obtener datos de teletransportación del jugador local
local TeleportService = game:GetService("TeleportService")
local teleportData = TeleportService:GetLocalPlayerTeleportData()
print("El jugador local llegó con estos datos:", teleportData)Get Player Place Instance Async
Parámetros
Devuelve
Muestras de código
Siguiendo a Otro Jugador
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
local followId = player.FollowUserId
if followId and followId ~= 0 then
-- ¿Está este jugador siguiendo a alguien? Si es así, encuentra dónde están
local success, currentInstance, error, placeId, jobIdOrErr = pcall(function()
return TeleportService:GetPlayerPlaceInstanceAsync(followId)
end)
-- followId es el ID de usuario del jugador del que quieres recuperar el lugar y el ID de trabajo
if success then
-- Teleporta al jugador con éxito en función del jobId
TeleportService:TeleportToPlaceInstance(placeId, jobIdOrErr, player)
else
-- Envía una advertencia basada en el error devuelto
warn(jobIdOrErr)
end
else
warn(("¡El jugador %d no está siguiendo a otro jugador!"):format(player.UserId))
end
end)Get Teleport Setting
Prompt Experience Details Async
Teleport Service: Prompt Experience Details Async(
Muestras de código
Mostrar Detalles de la Experiencia al Jugador
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local success, result = pcall(function()
TeleportService:PromptExperienceDetailsAsync(player, 8357232245)
end)
if not success then
warn("Error al mostrar los detalles de la experiencia: " .. tostring(result))
end
if result == Enum.PromptExperienceDetailsResult.PromptClosed then
print("El jugador cerró el aviso de detalles de la experiencia")
elseif result == Enum.PromptExperienceDetailsResult.TeleportAttempted then
print("El jugador eligió teletransportarse a la experiencia")
endReserve Server
Reserve Server Async
Set Teleport Gui
Parámetros
Devuelve
()
Muestras de código
Teletransportando al jugador local
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local playerGui = Players.LocalPlayer:WaitForChild("PlayerGui")
local PLACE_ID = 0 -- reemplazar aquí
local loadingGui = ReplicatedStorage:FindFirstChild("LoadingGui")
-- parentar la GUI de carga para este lugar
loadingGui.Parent = playerGui
-- establecer la GUI de carga para el lugar de destino
TeleportService:SetTeleportGui(loadingGui)
TeleportService:Teleport(PLACE_ID)Set Teleport Setting
Teleport
Teleport Async
Teleport Party Async
Teleport To Place Instance
Teleport To Private Server
Teleport To Spawn By Name
Eventos
Local Player Arrived From Teleport
Teleport Service. Local Player Arrived From Teleport(
Parámetros
dataTable:Variant |
Teleport Init Failed
Teleport Service. Teleport Init Failed(
player:Instance, teleport Result:Enum.TeleportResult, error Message:string, place Id:number, teleport Options:Instance
Parámetros