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

How do I use TeleportPartyAsync or TeleportToPrivateServer?

Asked by 5 years ago
Edited 5 years ago

I'm trying to create a script that teleports a group of players if they are "Ready" for the game, but whenever I try to use Teleport Party A Sync or Teleport To Private Server, it comes up with an HTTP 403 Error. Here's the code:

local timeleft = game:GetService("ReplicatedStorage"):WaitForChild("TimeLeft")
local teleserv = game:GetService("TeleportService")
local gameid = 3171170063

while true do
    for a = 1,timeleft.Value do
        timeleft.Value = timeleft.Value - 1
        wait(1)
    end
    for _,plr in pairs(game.Players:GetChildren()) do
        if plr:WaitForChild("Ready").Value == true and plr:IsA("Player") then
            print(plr.Name.." is ready to be teleported!")
            local reserve = teleserv:ReserveServer(gameid)
            teleserv:TeleportToPrivateServer(gameid,reserve,plr)
        else
            print(plr.Name.." was not ready for the party.")
        end
    end
    wait(5)
    timeleft.Value = 45
end

1 answer

Log in to vote
0
Answered by 5 years ago

I had that 403 error before, took me two days to find out. nothing to do your code, but the you may get the same error if you have wrong gameId.

No.1 cause, you cannot teleport from studio, it will give you 403. you have to publish both lobby and place in Roblox, enter the lobby from roblox player(not studio).

No.2 cause, it is your place settings.

go to roblox studio, on the menu bar, click "game settings", go to options, click "Allow HTTP Requests" to be "on". I activated this option in all places.

0
Thanks gamemaster60788 61 — 5y
Ad

Answer this question