When im updateing the game, Im shutdowning the servers. Or there is auto rejoining code that teleports player back to game in like being afk for 18 minutes.
the problem is some players in private servers are teleporting to the public servers. When i tried to migrate it is still same. what can I do?
heres the codes:
Shutdown code;
local function bindToClose(reason)
Knit.CallFunction("BindToCloseCalled", reason)
ShutdownService.Client.BindToCloseCalled:FireAll(reason)
workspace:SetAttribute("bindToCloseCalled", reason)
local playerList = Players:GetPlayers()
if #playerList == 0 then
return
end
local serverType = UTIL.getServerType()
local teleportData = {
ShutdownTeleport = true
}
local teleportOptions = Instance.new("TeleportOptions")
teleportOptions:SetTeleportData(teleportData)
if serverType == "ReservedServer" then
teleportOptions.ShouldReserveServer = true
end
task.wait(SHUTDOWN_START_DELAY)
playerList = Players:GetPlayers()
if #playerList == 0 then
return
end
UTIL.safe.teleport(PLACE_ID, playerList, teleportOptions)
local pastTime = 0
repeat
task.wait(1)
pastTime += 1
until pastTime >= SHUTDOWN_WAIT_TIME or #Players:GetPlayers() == 0
end
Rejoin code;
local function onTeleportSameGame(player)
local playerClass = PlayerService:getClass("player", player)
if not playerClass then
return
end
local serverType = UTIL.getServerType()
local teleportOptions
if serverType == "StandardServer" and #Players:GetPlayers() ~= 1 then
teleportOptions = Instance.new("TeleportOptions")
teleportOptions.ServerInstanceId = game.JobId
end
playerClass.IgnoreKick = true
playerClass:Destroy()
UTIL.safe.teleport(PLACE_ID, {player}, teleportOptions)
local pastTime = 0
repeat
task.wait(1)
pastTime += 1
until pastTime >= SHUTDOWN_WAIT_TIME or #Players:GetPlayers() == 0
end