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

[FE] How can I teleport multiple people to a place in Universes?

Asked by 6 years ago

I have been reading the roblox wiki and nothing showed how to make custom servers between places.

This is what I had:

local TS = game:GetService("TeleportService")
local Players = game:GetService("Players")
local DSS = game:GetService("DataStoreService")
local DS = DSS:GetGlobalDataStore()

-- Get the saved code
local code = DS:GetAsync("ReservedServer")
if type(code) ~= "string" then -- None saved, create one
    code = TS:ReserveServer(1387669291)
    DS:SetAsync("ReservedServer",code)
end

local function Joined(plr)
    -- Everytime they chat, we want to know
    plr.Chatted:connect(function(msg)
        if msg == "reserved" then -- Aha, that's our cue
            TS:TeleportToPrivateServer(1407760490,code,{plr})
        end
    end)
end

-- Connect all current and future players
Players.PlayerAdded:connect(Joined)
for k,v in pairs(Players:GetPlayers()) do
    Joined(v)
end

This would send an error and not teleport players to different servers. I would like custom servers. For example,

There is the start place and place A. In the start place, there are 10 players in it. I want to teleport 2 of those into place A without the others joining. Then I want to teleport 2 more players into place A without joining the other 2. How would I do this?

Answer this question