Teleport Private Server

Me and my friend are on the same private server. When teleporting to another place, why does it go to a different server?

I want my friend and I to be on the same server in a private server.

script.Parent.Destroyer.OnServerEvent:Connect(function(plr)
local TeleportService = game:GetService(“TeleportService”)
local placeId = 17403700675
if game.PrivateServerId ~= “” then
local code = TeleportService:ReserveServer(placeId)
TeleportService:TeleportToPrivateServer(placeId,code,{plr})
else
TeleportService:Teleport(placeId, plr)
end
end)

You will have to use local MemoryStoreService = game:GetService("MemoryStoreService")

Why do my friends and I still go to different private servers?

script.Parent.Destroyer.OnServerEvent:Connect(function(plr)
    script.Parent:WaitForChild("Teleporting").Enabled = true
    local TeleportService = game:GetService("TeleportService")
    local placeId = 17403700675
    local MemoryStoreService = game:GetService("MemoryStoreService")
    local CodeMap = MemoryStoreService:GetSortedMap("Code")
    if game.PrivateServerId ~= "" then
        local Code = CodeMap:GetAsync("ReservedServer")
        local ReserveServer = TeleportService:ReserveServer(placeId)
        CodeMap:SetAsync("ReservedServer", ReserveServer, 10)
        Code = ReserveServer
        TeleportService:TeleportToPrivateServer(placeId, Code, { plr })
    else
        TeleportService:Teleport(placeId, plr)
    end
end)

Ok thanks for Reply i somehow made it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.