Tryna make a code to find servers of a friend, i just don’t know how to
Could you say more about what you want to achieve?
I’m afraid I don’t undestand
Using messaging service, you can make a frame where if you enter a players name, you can search servers for that player and if found you can get that jobid and teleport to it. Although I don’t understand how to put it into code
Did you try that?
Edit:
Ah i think I know what you mean.
I think you must send a message to all servers and then send another message from the players server saying if the player is there
(and send the jobid)
Maybe there is a easier way but i have no idea now.
local targetGameId = game.GameId
local serverByFriends = {}
for i, v in ipairs(LocalPlayer:GetFriendsOnline())
if v.GameId == targetGameId then
serverByFriends[v.VisitorId] = {v.UserName, v.GameId}
end
end
Gave you the base, DIY the rest (Not tested yet)
TeleportService:TeleportToPlaceInstance(v.PlaceId, v.VisitorId, LocalPlayer)
From this
I think he meant something else.
Like a textbox where you search for players and join them. (not only friends)
Am i wrong @maccchh ?
Listen, What i mean is that I am making a main menu, like a hub. It has a option to find a friends public server and join it.
If you enter into the textbox ur friends name, and hes found playing the game inside of the hubs asset manager then you teleport to his jobid
Wouldnt it be better to just select the friend from a list of friends and then join him?
But if you are sure to make a textbox for typing you can just try to find the player in the Player:GetFriendsOnline()
list and then use @nvthane 's code but with an if statement checking if the place id is your games place id