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

How to follow a player to a server? (Teleport Service)

Asked by 7 years ago
Edited 7 years ago

I'm working on a little party system but got stuck a bit with the player following system. Now I could be wrong with the issue but, what I believe is causing the issue, is that when the player leaves the game try's to pull everyone that is in their party to their server but because they haven't loaded into the actual game yet they cannot follow them. (and so are teleported to the same server) How would I have the players in the party wait for the party host to be in the game server? Here is a full set of source code attached to a portal object.

01local TeleportService = game:GetService("TeleportService")
02local levelId = 1370155526
03 
04function onTouched(hit)
05    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
06    if player then     
07        local inParty = player.inParty.value
08        local isHost = player.isHosting.value      
09        if(inParty)then
10            if(not isHost)then
11                print("Only the party leader can join a game.")
12                return
13            end
14        end
15        player.Character.Humanoid.WalkSpeed = 0
View all 43 lines...

the followPlayer , isHosting, and playerFollow values are created inside another script, these are just to keep track of what party you are in and are edited by an outside source. This is purely just for the teleportation script.

Answer this question