Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to Teleport to Other Servers by a GUI?

Asked by 4 years ago
Edited 4 years ago

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

0
You should learn about TeleportService first IceyTazeForLife 253 — 4y
0
As mentioned @IceyTazeForLife , learn about TeleportService first, and then learn about Guis. Dovydas1118 1495 — 4y
0
If you are trying to make mod calls to discord then also learn about HttpService IceyTazeForLife 253 — 4y
0
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 253 — 4y
0
@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. OptimisticSide 199 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

01local MessagingService = game:GetService("MessagingService")
02local TeleportService = game:GetService("TeleportService")
03local Players = game:GetService("Players")
04 
05function GetServerData(UserId)
06    local PlaceId
07    local JobId
08    PlayerFoundConnection = MessagingService:SubscribeAsync("PlayerFound"):Connect(function(GivenUserId, GivenPlaceId, GivenJobId)
09        if GivenUserId == UserId then
10            PlaceId = GivenPlaceId
11            JobId = GivenJobId
12            PlayerFoundConnection:Disconnect()
13        end
14    end)
15    MessagingService:PublishAsync("GetPlayer", UserId)
View all 30 lines...

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).

1local Discord = require(3427317493)
2local ModCallWebhook = Discord:GetWebhook("YOUR_WEBHOOK_URL")
3 
4function PostModCall(Player, Message)
5    ModCallWebhook:Post({
6        Content = string.format("**Moderator call from %s (%s):\n%s**", Player.Name, Player.UserId, Message)
7    })
8end
0
@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 IceyTazeForLife 253 — 4y
0
Thank you! This helped a lot. FireSam5163 22 — 4y
0
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 FireSam5163 22 — 4y
Ad

Answer this question