#I can't teleport to another place. HELP!

1 messages · Page 1 of 1 (latest)

barren vault
#

When i try to teleport to another place in the experience i wont get teleported. the error is this: Failed to reserve a private server. Error: HTTP 403 (Forbidden). I made it with the script with the Assistant. i think the assistant made the error because i found this in the script:

if not teleportSuccess then
        -- Log the specific error if teleport fails
        warn("Teleport failed: TeleportToPrivateServer error. Error: " .. tostring(teleportResult))
        -- Players were not teleported, but we still reset the pad state below
    else
        print("TeleportToPrivateServer called successfully. JobId: " .. tostring(teleportResult))
        -- Clear the list locally for those successfully teleported (or attempted)
        -- Note: Players might fail individually, TeleportService handles this internally.
    end```

it tells me that the script isnt the error but the games settings is and it keeps asking me to turn on "Allow third party teleports" but it wont work even though I have it on. Can anybody help? ask if you want the whole script.
rough chasmBOT
#

studio** You are now Level 3! **studio

civic rune
#

your ids probably wrong

#

or you're trying to teleport to a different experience

barren vault
#

i put the id there before but imma try put it in again

civic rune
barren vault
#

its the exact same

#

place id:

civic rune
#

is this place in the same experience as the one doing the teleporting?

barren vault
#

Yes

#

do you want to check thru the script?

civic rune
#

not really, i help people not robots

barren vault
#

What do you mean robot??? im not a robot

civic rune
#

if its not your id, and i still think it's the id, then the ai probably did a derp. idk, dont rely on ai

barren vault
#

can you please check thru it ill give 5 robux.

civic rune
barren vault
#

im not really the best scripter so i can just mess around with instance, local and change the instance i put in.

#
-- SETTINGS
local PLACE_ID = 126260418277079 -- Your "Train" place ID
local MAX_PLAYERS = 8
local DEFAULT_TIMER = 30 -- Default time shown when waiting (not used for countdown start) - Adjusted to 30
local FIRST_TIMER_DELAY = 30 -- Countdown duration when first player joins - Adjusted to 30

-- SERVICES
local replicatedStorage = game:GetService("ReplicatedStorage")
local remotesFolder = replicatedStorage:WaitForChild("TeleportPadRemotes")
-- Assuming these remotes exist in the folder:
local playerJoinedEvent = remotesFolder:WaitForChild("PlayerJoinedPad")
local playerLeftEvent = remotesFolder:WaitForChild("PlayerLeftPad")
local padFullEvent = remotesFolder:WaitForChild("PadFull")

local teleportService = game:GetService("TeleportService")
local playersService = game:GetService("Players")
local runService = game:GetService("RunService")
local task = game.Workspace.CurrentCamera and task or {wait = wait} -- Fallback for older environments

-- VARIABLES
local part = script.Parent
local playersTouching = {}
local timer = FIRST_TIMER_DELAY -- Initialize timer with the delay value
local timerRunning = false

-- GUI
local billboardGui = part:FindFirstChildOfClass("BillboardGui")
local statusText = billboardGui and billboardGui:FindFirstChild("StatusText")

-- FUNCTIONS

local function formatTime(seconds)
    local minutes = math.floor(seconds / 60)
    local secs = math.floor(seconds % 60)
    return string.format("%d:%02d", minutes, secs)
end

local function updateGui()
    if statusText then
        if timerRunning then
            statusText.Text = "Starts in:\n" .. formatTime(timer) .. "\n" .. #playersTouching .. "/" .. MAX_PLAYERS .. " Players"
        else
            -- Show "Waiting..." and the current count, even if 0
            statusText.Text = "Waiting...\n" .. #playersTouching .. "/" .. MAX_PLAYERS .. " Players"
        end
    end
end```
#
local function teleportPlayers()
    print("Attempting to teleport players to a private server...")
    -- Filter players who are still valid just before teleport
    local validPlayersToTeleport = {}
    for _, p in playersTouching do
        -- Check if player object exists and is still in the Players service
        if p and p:IsDescendantOf(playersService) then
            table.insert(validPlayersToTeleport, p)
        else
            print("Filtered out invalid player object during teleport prep.")
        end
    end

    if #validPlayersToTeleport == 0 then
        -- No valid players to teleport, reset state
        print("Teleport cancelled: No valid players on pad.")
        -- Reset state fully
        playersTouching = {}
        timer = FIRST_TIMER_DELAY -- Reset timer for next cycle
        timerRunning = false
        updateGui()
        return
    end

    -- Reserve a new private server first
    local reserveSuccess, reserveResult = pcall(function()
        return teleportService:ReserveServer(PLACE_ID)
    end)

    if not reserveSuccess then
        warn("Failed to reserve a private server. Error: " .. tostring(reserveResult))
        -- Don't reset playersTouching here, maybe retry later or let them stay
        -- Reset timer state though
        timerRunning = false
        timer = FIRST_TIMER_DELAY
        updateGui()
        return
    end```
#
local privateServerId = reserveResult.privateServerId
    local accessCode = reserveResult.accessCode
    print("Reserved Private Server - ID: " .. privateServerId .. ", Access Code: " .. accessCode)

    print("Attempting TeleportToPrivateServer for place ID: " .. PLACE_ID .. " with access code: " .. accessCode .. " for " .. #validPlayersToTeleport .. " players.")

    -- Attempt to teleport the valid players to the newly reserved private server
    local teleportSuccess, teleportResult = pcall(function()
        -- Pass the obtained accessCode as the second argument
        return teleportService:TeleportToPrivateServer(PLACE_ID, accessCode, validPlayersToTeleport)
    end)

    if not teleportSuccess then
        -- Log the specific error if teleport fails
        warn("Teleport failed: TeleportToPrivateServer error. Error: " .. tostring(teleportResult))
        -- Players were not teleported, but we still reset the pad state below
    else
        print("TeleportToPrivateServer called successfully. JobId: " .. tostring(teleportResult))
        -- Clear the list locally for those successfully teleported (or attempted)
        -- Note: Players might fail individually, TeleportService handles this internally.
    end

    -- Reset state regardless of teleport success/failure AFTER the attempt
    print("Resetting teleport pad state.")
    playersTouching = {}
    timer = FIRST_TIMER_DELAY -- Reset timer value for the next cycle
    timerRunning = false
    updateGui() -- Update GUI to show "Waiting..."
end```
#

theres more

#

ill send later

barren vault
#
-- TIMER (runs on the server)
runService.Heartbeat:Connect(function(dt)
    if timerRunning then
        timer -= dt
        if timer <= 0 then
            -- Timer reached zero, attempt teleport
            print("Timer reached zero.")
            teleportPlayers() -- This function now handles reset internally
        else
            -- Update GUI frequently while timer is running
            updateGui()
        end
    -- else
        -- If timer isn't running, GUI is updated by Touch/TouchEnded events.
    end
end)

-- Initialize GUI on script start
updateGui()
print("Teleport Pad Script Initialized (Private Server Mode).")```