In my game there is a big explosion and after that half of the map is destroyed, so i wanted to teleport all the players in the server to a new fresh server (they teleport together in a group).
I also want to send teleportdata and the teleportgui with it.
I’ve tried many ways like:
local reserverservercode = TeleportService:ReserveServer(game.PlaceId)
TeleportService:TeleportToPrivateServer(game.PlaceId, reserverservercode, game.Players:GetPlayers(), nil, TeleportData, TeleportGui)
TeleportService:TeleportToPlaceInstance(game.PlaceId, game.HttpService:GenerateGUID(), game.Players:GetPlayers(), nil, TeleportData, TeleportGui)
TeleportService:TeleportAsync(game.PlaceId, game.Players:GetPlayers())
TeleportService:TeleportPartyAsync(game.PlaceId, game.Players:GetPlayers(), TeleportData, TeleportGui)
PartyAsync kinda worked but when i arrived at the new server i got this kick message:
so sadly none of those methods worked.
1 Like
To teleport all players in the server to a new fresh server, you can use the TeleportService:TeleportPartyAsync() method. However, to avoid the kick message issue, you need to make sure that the TeleportData and TeleportGui parameters are set correctly.
This should work:
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local placeId = game.PlaceId
local players = Players:GetPlayers()
local teleportData = -- Your teleport data here
local teleportGui = -- Your teleport GUI here
local function teleportPlayers()
local success, errorMessage = pcall(function()
TeleportService:TeleportPartyAsync(placeId, players, teleportData, teleportGui)
end)
if not success then
print("Teleport failed: " .. errorMessage)
end
end
teleportPlayers()
Make sure to replace – Your teleport data here and – Your teleport GUI here with the actual data and GUI you want to send.
1 Like
My script was almost the exacly the same as yours but i still got the kick message when teleporting to the new server.
The kick message appeared after i got teleported.
local TeleportData = { LoadingScreenEnabled = false }
local TeleportGui = game.ServerStorage.CoreStorage.CoreShutdown:WaitForChild("TeleportLoadingGui")
local success, result = pcall(function()
return TeleportService:TeleportPartyAsync(game.PlaceId, game.Players:GetPlayers(), TeleportData, TeleportGui)
end)
if not success then
print("Teleport failed: " .. result)
end