I would like the mods in my game to be able to join other players when they report. Here is an example. prnt.sc/sw06xm
How to Teleport to Other Servers by a GUI?
1 answer
There are two ways to get a player. The first would be to use a DataStore, and the other would be to use MessagingService. I believe that the second option is the best, as it is not too reliant on a DataStore. We are going to be trying to get the JobId of the server that a player of the given UserId is in. Once we have the JobId, we can teleport to that player.
local MessagingService = game:GetService("MessagingService")
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
function GetServerData(UserId)
local PlaceId
local JobId
PlayerFoundConnection = MessagingService:SubscribeAsync("PlayerFound"):Connect(function(GivenUserId, GivenPlaceId, GivenJobId)
if GivenUserId == UserId then
PlaceId = GivenPlaceId
JobId = GivenJobId
PlayerFoundConnection:Disconnect()
end
end)
MessagingService:PublishAsync("GetPlayer", UserId)
repeat wait() until not PlayerFoundConnection.Connected
return PlaceId, JobId
end
function TeleportPlayer(Player, PlaceId, JobId)
TeleportService:TeleportToPlaceInstance(PlaceId, JobId, Player)
end
MessagingService:SubscribeAsync("GetPlayer"):Connect(function(UserId)
for _, Player in pairs(Players:GetPlayers()) do
if Player.UserId == UserId then
MessagingService:PublishAsync("PlayerFound", UserId, game.PlaceId, game.JobId)
end
end
end)
As you can see, we have two functions: GetServerData, and TeleportPlayer. These functions can be referenced later on in the script.
Edit:
People are saying you need help regarding Discord as well, so let me break that down for you as well. :)
Discord has this thing called Webhooks, which are just a way of posting messages on Discord remotely (which in this case, is ROBLOX). A webhook can be added from a server or channel's configuration. I'll be showing you how I do Discord webhooks (with my module, as it makes things simpler).
local Discord = require(3427317493)
local ModCallWebhook = Discord:GetWebhook("YOUR_WEBHOOK_URL")
function PostModCall(Player, Message)
ModCallWebhook:Post({
Content = string.format("**Moderator call from %s (%s):\n%s**", Player.Name, Player.UserId, Message)
})
end
3 comments
@OptimisticSide Thank you for the explanation, I just don't understand the code to find the player in other servers. Please explain me the code more if you can. Thanks
Thank you! This helped a lot.
I also made this GUI, would you know how to configure that with the GUI. Here's the link: https://www.roblox.com/library/5157648137/Teleport
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
You should learn about TeleportService first
As mentioned @IceyTazeForLife , learn about TeleportService first, and then learn about Guis.
If you are trying to make mod calls to discord then also learn about HttpService
This is a very good tutorial explaining webhooks - https://www.youtube.com/watch?v=Rj-v5A5scho. An idea I recommend is to make a discord server then whenever someone sends a report, it will post it on discord where mods/admins can see it and join the server. I would explain how to make the gui but it would take up too much of my time.
@IceyTazeForLife, He did not say he needed help with mod calls. He only wants help regarding teleporting a player to another player's server via their user-ID.