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

[SOLVED] Lobby Queue System Doesn't Teleport Players To Private Server?

Asked by 1 year ago
Edited 1 year ago

I got the script from a youtube video and just edited some stuff i guess

https://www.youtube.com/watch?v=bxCKWMiV8CA

so this script is supposed to act like a casual story game lobby system, there's a timer and every time the timer ticks to 0, the players in the queue will get a loading screen and get teleported, and a GUI button appears to leave the queue, all of the script is working except the actual part that teleports the player to a private server of the placed. instead it gives me this error HTTP 403 (Forbidden) at line 39

sorry if this isn't described well

Server Sided Script

local TS = game:GetService("TeleportService")
local TweenService = game:GetService("TweenService")
local placeId = 12804178720 -- Enter a second Id Place.
local leaveGuiEvent = game.ReplicatedStorage:FindFirstChild('LeaveGuiEvent')
local TransitionEvent = game.ReplicatedStorage:FindFirstChild('TransitionEvent')
local list = {}
local billboard = script.Parent.billboardPart.billboardGui
local timer = nil
local teleporting = false
local spawnTeleport = script.Parent.spawn

local function updateGui()
    billboard.Frame.players.Text = "Players: " ..#list.. "/1" -- Change the number 16 according to the Max Player who want to be teleported.
end

local function removeFromList(character)
    for i=1,#list do
        if list[i] == character.Name then
            table.remove(list,i)
            updateGui()
        end
    end
end

local function teleportPlayers()
    if #list > 0 then
        billboard.Frame.Status.Text = "TELEPORTING"
        billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
        local playersToTeleport = {}
        local teleportTime = 0
        for i=1,#list do
            if game.Players:findFirstChild(list[i]) then
                table.insert(playersToTeleport,game.Players:findFirstChild(list[i]))
                TransitionEvent:FireClient(game.Players:findFirstChild(list[i]))
            else
                table.remove(list,i)    
            end
        end 
        local code = TS:ReserveServer(placeId)
        teleporting = true
        TS:TeleportToPrivateServer(placeId,code,playersToTeleport)
        repeat wait() until #list <= 0
        billboard.Frame.Status.Text = "READY"
        billboard.Frame.Status.TextColor3 = Color3.fromRGB(255, 0, 0)
        teleporting = false
    end
end

script.Parent.Gate.Touched:Connect(function(hit)
    if hit.Parent:findFirstChild("Humanoid") then
        if teleporting == false then
            local char = hit.Parent
            local player = game.Players:FindFirstChild(char.Name)
            local alreadyExists = false

            for i=1,#list do
                if list[i] == char.Name then
                    alreadyExists = true
                end
            end

            if alreadyExists == false then
                if #list < 1 then -- Many Players have been teleported.
                    table.insert(list,char.Name)
                    char.PrimaryPart.CFrame = spawnTeleport.CFrame
                    updateGui()
                    leaveGuiEvent:FireClient(player)
                end

                player.CharacterRemoving:connect(function(character)
                    removeFromList(character)
                end)
            end

        end
    end
end)

leaveGuiEvent.OnServerEvent:Connect(function(player)
    if player.Character then
        player.Character.HumanoidRootPart.Anchored = false
        wait()
        player.Character.Humanoid.Jump = true
        wait()
        player.Character:MoveTo(game.Workspace.chapter1sololeave.Position)
        removeFromList(player.Character)
    end
end)

while wait() do
    timer = 20 -- Wait time before teleport change to whawtever you want it to be
    for i=1,timer do
        timer = timer - 1
        billboard.Frame.time.Text = timer
        wait(1)
    end
    teleportPlayers()
end
1
Did you try this in Studio? Did you check the output? T3_MasterGamer 2189 — 1y
0
i tried in both studio and roblox client. i havent checked yet, ill update you on the results JmoneyPlayzOfficial 49 — 1y
0
i got this error HTTP 403 (Forbidden) located at line 39 JmoneyPlayzOfficial 49 — 1y
1
No, like I meant that if you playtested or played in Roblox App, I didn't meant that you should try both. T3_MasterGamer 2189 — 1y
View all comments (3 more)
0
I'm asking that becuase TeleportService won't work in playtest Roblox Studio. T3_MasterGamer 2189 — 1y
0
well i did but i done some changes so i'll see how that goes JmoneyPlayzOfficial 49 — 1y
0
i tried it and it worked, thank you JmoneyPlayzOfficial 49 — 1y

Answer this question