I’m trying to make it so I can join specific players when they are in reserved private servers.
The problem is its not letting me join the server, it says that the place id is 0 so it wont teleport me
I haven’t thought of anything that I did wrong, maybe I’m missing something
This is my script to teleport the initial group of players, the person we are joining is in a server that was created like this
local PlaceID = --my place id
local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local code1 = TS:ReserveServer(PlaceID)
local PlayersList = {}
for _, v in pairs(players) do
table.insert(PlayersList, Players:WaitForChild(v))
end
TS:TeleportToPrivateServer(PlaceID, code1, PlayersList)
players = {}
This is my script on teleporting to a player’s server based off of their name
--Player name is the name of the player who we are trying to join
local playerId = game.Players:GetUserIdFromNameAsync(playerName)
local placeId = teleportService:GetPlayerPlaceInstanceAsync(playerId)
teleportService:Teleport(placeId,plr)
I have tried printing out these values, the player id is the id of my player, and the place id is “false”
If you have any ideas of what I’m missing, please let me know
You dont really have to write anything for me, just give me a general idea of what I need to do
The way you’re trying to access another player’s reserved server is wrong anyway. Reserved servers can only be teleported to via TeleportToPrivateServer because you need an access code to join the server; you can’t join off of only the PlaceId or the server’s JobId. If the PlaceId were valid it would put players into automatic Roblox matchmaking, not a private server.
You need to save the access code in the target server if you want to join it later. You can then use MessagingService to ping all servers looking for the target player you want to join and if any of those servers have the player in question you can send back a message including the access code of that server and then feed it into TeleportToPrivateServer.
Good rule of thumb is that for joining, reserved servers are represented by their access code. Their JobId is only for identity purposes and, unlike in cases of automatic matchmaking, can’t actually be used with any teleport methods. GetPlayerPlaceInstanceAsync would be useful if you wanted to join public matches but reserved servers are taken out of automatic matchmaking so it doesn’t work.
Example flow:
Teleporting initial group:
Collect players → Call ReserveServer → Save access code to DataStore with PrivateServerId as key and access code as value → TeleportToPrivateServer on the collected players
Joining players by name:
Call PublishAsync with topic “X” and a message of the player’s name who you’re attempting to join → “To consume join requests happens” → move on to point 2 here
SubscribeAsync with topic “Y” → Check PrivateServerId sent in payload → GetAsync on DataStore containing your access codes → If non-nil is returned, call TeleportToPrivateServer with the retrieved access code
To consume join requests:
SubscribeAsync on each server to topic “X” → Check if a Player matching the name in the payload exists in the current server → If player exists, call PublishAsync with topic “Y” and pass the server’s PrivateServerId as the message → Revisit “Joining players by name” point 2
Feels like a huge oversight that GetFriendsOnline doesn’t return this info. Roblox makes it really tough to play with friends & stick together in big games.